Ticket #2227: perl-5.10.0-fixes.diff

File perl-5.10.0-fixes.diff, 2.3 KB (added by robert@…, 16 years ago)

upstream fixes

  • lib/File/CVE-2008-2827.t

    From:	http://rt.cpan.org/Public/Bug/Display.html?id=36982
    	http://rt.perl.org/rt3/Public/Bug/Display.html?id=54566
    
    	Perl bug 54566 patch from:
    	http://cvs.fedoraproject.org/viewvc/devel/perl/perl-5.10.0-bz448392.patch?view=co
    
    diff -Naur perl-5.10.0.orig/lib/File/CVE-2008-2827.t perl-5.10.0/lib/File/CVE-2008-2827.t
    old new  
     1#!perl -w
     2
     3# Test case derived from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487319
     4
     5my $foo = "foo-$$";
     6my $bar = "bar-$$";
     7
     8die "Not clean [$foo] [$bar]" if -e $foo || -e $bar;
     9
     10eval {
     11    symlink($foo, $bar) || die "Can't symlink $foo --> $bar";
     12};
     13if ($@) {
     14    print "1..0 # Skipped: Only systems that can do symlinks are affected\n";
     15    print "$@\n";
     16    exit;
     17}
     18
     19use Test;
     20plan tests => 5;
     21
     22umask(0027);
     23
     24# touch foo
     25open(my $fh, ">", $foo) || die "Can't create $foo\n";
     26close($fh);
     27
     28my $m = (stat $foo)[2];
     29ok(defined $m);
     30
     31require File::Path;
     32ok(File::Path::rmtree($bar));
     33ok(!-e $bar);
     34
     35# If the mode of $foo changed as a result of removing $bar then we are vulnerable
     36ok($m, (stat $foo)[2]);
     37
     38unlink($foo);
     39ok(!-e $foo);
  • lib/File/Path.pm

    diff -Naur perl-5.10.0.orig/lib/File/Path.pm perl-5.10.0/lib/File/Path.pm
    old new  
    350350                next ROOT_DIR;
    351351            }
    352352
    353             my $nperm = $perm & 07777 | 0600;
    354             if ($nperm != $perm and not chmod $nperm, $root) {
    355                 if ($Force_Writeable) {
     353            if ($Force_Writeable) {
     354                my $nperm = $perm & 07777 | 0600;
     355                if ($nperm != $perm and not chmod $nperm, $root) {
    356356                    _error($arg, "cannot make file writeable", $canon);
    357357                }
    358358            }
  • perl-5.10.0

    diff -Naur perl-5.10.0.orig/mg.c perl-5.10.0/mg.c
    old new  
    15431543    stash = GvSTASH(
    15441544        SvTYPE(mg->mg_obj) == SVt_PVGV
    15451545            ? (GV*)mg->mg_obj
    1546             : (GV*)SvMAGIC(mg->mg_obj)->mg_obj
     1546            : (GV*)mg_find(mg->mg_obj, PERL_MAGIC_isa)->mg_obj
    15471547    );
    15481548
    15491549    mro_isa_changed_in(stash);