@@ -205,13 +205,11 @@ [OFMutableSet setWithArray: files]; for (OFZIPArchiveEntry *entry in [_archive entries]) { void *pool = objc_autoreleasePoolPush(); OFString *fileName = [entry fileName]; - OFString *outFileName = [fileName stringByStandardizingPath]; - OFArray OF_GENERIC(OFString *) *pathComponents; - OFString *directory; + OFString *outFileName, *directory; OFStream *stream; OFFile *output; uint64_t written = 0, size = [entry uncompressedSize]; int8_t percent = -1, newPercent; @@ -218,40 +216,21 @@ if (!all && ![files containsObject: fileName]) continue; [missing removeObject: fileName]; -#if !defined(OF_WINDOWS) && !defined(OF_MSDOS) - if ([outFileName hasPrefix: @"/"]) { -#else - if ([outFileName hasPrefix: @"/"] || - [outFileName containsString: @":"]) { -#endif + outFileName = [app safeLocalPathForPath: fileName]; + if (outFileName == nil) { [of_stderr writeLine: OF_LOCALIZED( @"refusing_to_extract_file", @"Refusing to extract %[file]!", @"file", fileName)]; app->_exitStatus = 1; goto outer_loop_end; } - pathComponents = [outFileName pathComponents]; - for (OFString *component in pathComponents) { - if ([component length] == 0 || - [component isEqual: @".."]) { - [of_stderr writeLine: OF_LOCALIZED( - @"refusing_to_extract_file", - @"Refusing to extract %[file]!", - @"file", fileName)]; - - app->_exitStatus = 1; - goto outer_loop_end; - } - } - outFileName = [OFString pathWithComponents: pathComponents]; - if (app->_outputLevel >= 0) [of_stdout writeString: OF_LOCALIZED(@"extracting_file", @"Extracting %[file]...", @"file", fileName)];