UnzipOpenFile (ZipArchive) is return uncorrectly when password is not right
i'm using ZipArchive library to unzip/zip files in my iOS application.
I noticed that UnzipOpenFile will not return false when password is not
correct. Below is the sources.
Is there anybody has similar issue? (I have added my comments on it)
-(BOOL) UnzipOpenFile:(NSString*) zipFile
{
_unzFile = unzOpen( (const char*)[zipFile UTF8String] );
if( _unzFile )
{
unz_global_info globalInfo = {0};
if( unzGetGlobalInfo(_unzFile, &globalInfo )==UNZ_OK )
{
//NSLog([NSString stringWithFormat:@"%ld entries in the zip
file",globalInfo.number_entry] );
return false; // i have to add this myself here.
}
}
return _unzFile!=NULL;
}
-(BOOL) UnzipOpenFile:(NSString*) zipFile Password:(NSString*) password
{
_password = password;
return [self UnzipOpenFile:zipFile];
}
No comments:
Post a Comment