Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public static void decompress(String in, File destination) throws IOException {
continue;
}
File curfile = new File(destination, entry.getName());
if (!curfile.toPath().normalize().startsWith(destination.toPath().normalize())) {
throw new IOException("Bad zip entry");
}
File parent = curfile.getParentFile();
if (!parent.exists()) {
if (!parent.mkdirs()) {
Expand Down Expand Up @@ -66,4 +69,4 @@ private static void addToArchiveCompression(JarArchiveOutputStream out, File fil
System.out.println(file.getName() + " is not supported");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public static void decompress(String in, File destination) throws IOException {
continue;
}
File curfile = new File(destination, entry.getName());
if (!curfile.toPath().normalize().startsWith(destination.toPath().normalize())) {
throw new IOException("Bad zip entry");
}
File parent = curfile.getParentFile();
if (!parent.exists()) {
if (!parent.mkdirs()) {
Expand Down