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