From: Michael G. Schwern Date: Sat, 16 Aug 2003 14:58:25 +0000 (-0700) Subject: Taint safe Cwd::_qnx_abs_path() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=39741d738e6fb2ee9de47dcf0299296483fa68f1;hp=ff882698b6698d58b88207970341d9a7b204c28d;p=p5sagit%2Fp5-mst-13.2.git Taint safe Cwd::_qnx_abs_path() Message-ID: <20030816215824.GF5859@windhund.schwern.org> (plus local *REALPATH) p4raw-id: //depot/perl@20749 --- diff --git a/lib/Cwd.pm b/lib/Cwd.pm index db13aab..984375f 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -469,7 +469,7 @@ sub _vms_abs_path { sub _os2_cwd { $ENV{'PWD'} = `cmd /c cd`; - chop $ENV{'PWD'}; + chomp $ENV{'PWD'}; $ENV{'PWD'} =~ s:\\:/:g ; return $ENV{'PWD'}; } @@ -488,7 +488,7 @@ sub _win32_cwd { sub _dos_cwd { if (!defined &Dos::GetCwd) { $ENV{'PWD'} = `command /c cd`; - chop $ENV{'PWD'}; + chomp $ENV{'PWD'}; $ENV{'PWD'} =~ s:\\:/:g ; } else { $ENV{'PWD'} = Dos::GetCwd(); @@ -501,7 +501,7 @@ sub _qnx_cwd { local $ENV{CDPATH} = ''; local $ENV{ENV} = ''; $ENV{'PWD'} = `/usr/bin/fullpath -t`; - chop $ENV{'PWD'}; + chomp $ENV{'PWD'}; return $ENV{'PWD'}; } @@ -510,8 +510,13 @@ sub _qnx_abs_path { local $ENV{CDPATH} = ''; local $ENV{ENV} = ''; my $path = @_ ? shift : '.'; - my $realpath=`/usr/bin/fullpath -t $path`; - chop $realpath; + local *REALPATH; + + open(REALPATH, '-|', '/usr/bin/fullpath', '-t', $path) or + die "Can't open /usr/bin/fullpath: $!"; + my $realpath = ; + close REALPATH; + chomp $realpath; return $realpath; }