1
0
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:
Jacob Prezant 2026-01-02 15:42:07 -05:00
parent d11c04666a
commit 72e6d652fc

View File

@ -58,6 +58,12 @@ int extract(NSString* fileToExtract, NSString* extractionPath)
return 1;
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];
//printf("extracting %@ to %@\n", currentFile, fullOutputPath);
archive_entry_set_pathname(entry, fullOutputPath.fileSystemRepresentation);