diff --git a/src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/TestUtilsFactory.java b/src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/TestUtilsFactory.java index 5e95dd8..1cf0334 100644 --- a/src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/TestUtilsFactory.java +++ b/src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/TestUtilsFactory.java @@ -787,7 +787,10 @@ public static void unzipFunction(String destinationFolder, String zipFile) { Boolean print = true; while (entry != null) { String entryName = entry.getName(); - File file = new File(destinationFolder + File.separator + entryName); + File file = new File(destinationFolder, entryName); + if (!file.toPath().normalize().startsWith(destinationFolder)) { + throw new RuntimeException("Bad zip entry"); + } // only print first entry, the zip-file itself if (print) {