File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
api-client/src/test/java/de/gesellix/docker/remote/api/testutil Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change 33import okio .BufferedSink ;
44import okio .Okio ;
55import okio .Sink ;
6+
67import org .apache .commons .compress .archivers .tar .TarArchiveEntry ;
78import org .apache .commons .compress .archivers .tar .TarArchiveInputStream ;
89import org .apache .commons .compress .archivers .tar .TarArchiveOutputStream ;
@@ -27,6 +28,9 @@ public File unTar(InputStream tar) throws IOException {
2728 TarArchiveEntry tarEntry ;
2829 while ((tarEntry = tis .getNextEntry ()) != null ) {
2930 File outputFile = new File (destDir , tarEntry .getName ());
31+ if (!outputFile .toPath ().normalize ().startsWith (destDir .toPath ())) {
32+ throw new RuntimeException ("Bad zip entry" );
33+ }
3034 if (tarEntry .isDirectory ()) {
3135 if (!outputFile .exists ()) {
3236 outputFile .mkdirs ();
You can’t perform that action at this time.
0 commit comments