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
|
|
|
6 | 6 | # Published under GNU GPL conditions |
7 | 7 | |
8 | 8 | use strict; |
| 9 | use Text::Diff; |
9 | 10 | |
10 | 11 | my $VERSION = '0.1'; |
11 | 12 | |
… |
… |
|
73 | 74 | $flag = "-j"; |
74 | 75 | } |
75 | 76 | |
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 | |
77 | 83 | return $list; |
78 | 84 | } |
79 | 85 | |
… |
… |
|
116 | 122 | if(-d $file1 and -d $file2){ |
117 | 123 | return 0; |
118 | 124 | }elsif(-f $file1 and -f $file2){ |
119 | | my $diff = `diff $file1 $file2`; |
| 125 | my $diff = diff $file1, $file2, { STYLE => "OldStyle" }; |
120 | 126 | if($diff){ |
121 | 127 | if($opt_stats){ |
122 | 128 | my $plus = 0; |