From 39741d738e6fb2ee9de47dcf0299296483fa68f1 Mon Sep 17 00:00:00 2001 From: "Michael G. Schwern" Date: Sat, 16 Aug 2003 07:58:25 -0700 Subject: Taint safe Cwd::_qnx_abs_path() Message-ID: <20030816215824.GF5859@windhund.schwern.org> (plus local *REALPATH) p4raw-id: //depot/perl@20749 --- lib/Cwd.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/Cwd.pm b/lib/Cwd.pm index db13aab433..984375fb0f 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; } -- cgit v1.2.1