mirror of
https://github.com/opa334/TrollStore.git
synced 2026-01-11 15:42:24 +08:00
fix: zip slip path traversal
This commit is contained in:
parent
d11c04666a
commit
72e6d652fc
@ -58,6 +58,12 @@ int extract(NSString* fileToExtract, NSString* extractionPath)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
NSString* currentFile = [NSString stringWithUTF8String:archive_entry_pathname(entry)];
|
NSString* currentFile = [NSString stringWithUTF8String:archive_entry_pathname(entry)];
|
||||||
|
if (currentFile.length == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ([currentFile hasPrefix:@"/"] || [currentFile containsString:@".."]) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
NSString* fullOutputPath = [extractionPath stringByAppendingPathComponent:currentFile];
|
NSString* fullOutputPath = [extractionPath stringByAppendingPathComponent:currentFile];
|
||||||
//printf("extracting %@ to %@\n", currentFile, fullOutputPath);
|
//printf("extracting %@ to %@\n", currentFile, fullOutputPath);
|
||||||
archive_entry_set_pathname(entry, fullOutputPath.fileSystemRepresentation);
|
archive_entry_set_pathname(entry, fullOutputPath.fileSystemRepresentation);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user