Avoid exposing tar file names to the shell. Closes: #500499
authorJoey Hess <joey@kodama.kitenet.net>
Wed, 3 Dec 2008 20:26:55 +0000 (15:26 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 3 Dec 2008 20:26:55 +0000 (15:26 -0500)
debian/changelog
pristine-tar

index 271dd5044c73cd7388a5c04529e897243fc75c3c..ae22431fd51beb67a67250089c4e483b0c94054f 100644 (file)
@@ -15,6 +15,7 @@ pristine-tar (0.19) UNRELEASED; urgency=low
   * zgz: Avoid using uninitialized data as timestamp in -c mode.
     Closes: #507095
   * Document existing long options. Closes: #499488
+  * Avoid exposing tar file names to the shell. Closes: #500499
 
  -- Josh Triplett <josh@freedesktop.org>  Thu, 27 Nov 2008 19:54:29 -0800
 
index c0a88396584f4df45b91e4f6d7986936b5948b4c..5c522f4102d1975fd2a1028f0d9e2525fe48833e 100755 (executable)
@@ -429,7 +429,11 @@ sub gendelta {
            $id1 == GZIP_ID1 && $id2 == GZIP_ID2 &&
            $method == GZIP_METHOD_DEFLATE) {
                $compression='gz';
-               doit("zcat $tarball > $tempdir/origtarball");
+               open(IN, "-|", "zcat", $tarball) || die "zcat: $!";
+               open(OUT, ">", "$tempdir/origtarball") || die "$tempdir/origtarball: $!";
+               print OUT $_ while <IN>;
+               close IN || die "zcat: $!";
+               close OUT || die "$tempdir/origtarball: $!";
        }
        else {
                seek(IN, 0, 0) || die "seek: $!";
@@ -438,7 +442,11 @@ sub gendelta {
                    $id1 == BZIP2_ID1 && $id2 == BZIP2_ID2 &&
                    $method == BZIP2_METHOD_HUFFMAN) {
                        $compression='bz2';
-                       doit("bzcat $tarball > $tempdir/origtarball");
+                       open(IN, "-|", "bzcat", $tarball) || die "bzcat: $!";
+                       open(OUT, ">", "$tempdir/origtarball") || die "$tempdir/origtarball: $!";
+                       print OUT $_ while <IN>;
+                       close IN || die "bzcat: $!";
+                       close OUT || die "$tempdir/origtarball: $!";
                }
        }
        close IN;