mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-21 01:07:34 +01:00
fix: cut down length of zipslip exceptions
This commit is contained in:
parent
b17832f0e1
commit
49a167540f
@ -79,18 +79,18 @@ public class BrutIO {
|
||||
|
||||
public static String sanitizeUnknownFile(final File directory, final String entry) throws IOException, BrutException {
|
||||
if (entry.length() == 0) {
|
||||
throw new InvalidUnknownFileException("Invalid Unknown File - " + entry);
|
||||
throw new InvalidUnknownFileException("Invalid Unknown File");
|
||||
}
|
||||
|
||||
if (new File(entry).isAbsolute()) {
|
||||
throw new RootUnknownFileException("Absolute Unknown Files is not allowed - " + entry);
|
||||
throw new RootUnknownFileException("Absolute Unknown Files is not allowed");
|
||||
}
|
||||
|
||||
final String canonicalDirPath = directory.getCanonicalPath() + File.separator;
|
||||
final String canonicalEntryPath = new File(directory, entry).getCanonicalPath();
|
||||
|
||||
if (!canonicalEntryPath.startsWith(canonicalDirPath)) {
|
||||
throw new TraversalUnknownFileException("Directory Traversal is not allowed - " + entry);
|
||||
throw new TraversalUnknownFileException("Directory Traversal is not allowed");
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/q/2375903/455008
|
||||
|
Loading…
x
Reference in New Issue
Block a user