Skip to content

Commit

Permalink
Fixed bug in -deleteFile:error: that causes a buffer overrun vulnerab…
Browse files Browse the repository at this point in the history
…ility (Issue #106)
  • Loading branch information
abbeycode committed Mar 14, 2021
1 parent b60747b commit 86dd120
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/UZKArchive.m
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ - (BOOL)deleteFile:(NSString *)filePath error:(NSError * __autoreleasing*)error
}

UZKLogDebug("Allocating commentary");
char *commentary = (char*)malloc(unzipInfo.size_file_comment);
char *commentary = unzipInfo.size_file_comment > 0 ? (char*)malloc(unzipInfo.size_file_comment) : NULL;
if ((commentary == NULL) && (unzipInfo.size_file_comment != 0)) {
NSString *detail = [NSString localizedStringWithFormat:NSLocalizedStringFromTableInBundle(@"Error allocating commentary info of %@ while deleting %@", @"UnzipKit", _resources, @"Detailed error string"),
currentFileName, filePath];
Expand Down

0 comments on commit 86dd120

Please sign in to comment.