Ticket #51292: patch-CVE-2015-0857.diff

File patch-CVE-2015-0857.diff, 1.3 KB (added by raimue (Rainer Müller), 9 years ago)
  • tardiff

    Upstream: https://anonscm.debian.org/cgit/collab-maint/tardiff.git/tree/debian/patches/CVE-2015-0857.diff
    Edit: gnutar instead of tar
    
    Description: Fix local code execution when calling diff (CVE-2015-0857)
     Reported by Rainer Müller <raimue@codingfarm.de>. Implemented using
     Text::Diff instead of diff and backticks.
    Author: Axel Beckert <abe@debian.org>
    Bug-CVE: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-0857
    
     
    66# Published under GNU GPL conditions
    77
    88use strict;
     9use Text::Diff;
    910
    1011my $VERSION = '0.1';
    1112
     
    7374                $flag = "-j";
    7475        }
    7576
    76         my $list = `gnutar -C $tempdir $flag -xvf $tarball 2>/dev/null`;
     77        open(TARLIST, '-|', qw(gnutar -C), $tempdir, $flag, qw(-xvf), $tarball)
     78            or die "Can't call tar as expected: $!";
     79        local $/ = undef; # slurp mode
     80        my $list = <TARLIST> or die "Couldn't read from tar";
     81        close(TARLIST) or warn "tar exited with non-zero exit code";
     82
    7783        return $list;
    7884}
    7985
     
    116122        if(-d $file1 and -d $file2){
    117123                return 0;
    118124        }elsif(-f $file1 and -f $file2){
    119                 my $diff = `diff $file1 $file2`;
     125                my $diff = diff $file1, $file2, { STYLE => "OldStyle" };
    120126                if($diff){
    121127                        if($opt_stats){
    122128                                my $plus = 0;