diff --git a/src/main/java/net/codestory/simplelenium/driver/Downloader.java b/src/main/java/net/codestory/simplelenium/driver/Downloader.java index 8c06999..31a4197 100644 --- a/src/main/java/net/codestory/simplelenium/driver/Downloader.java +++ b/src/main/java/net/codestory/simplelenium/driver/Downloader.java @@ -135,6 +135,10 @@ protected void unzip(File zip, File toDir) throws IOException { File to = new File(toDir, entry.getName()); + if (!to.toPath().normalize().startsWith(toDir.toPath().normalize())) { + throw new IOException("Bad zip entry"); + } + File parent = to.getParentFile(); if (!parent.exists()) { if (!parent.mkdirs()) {