summaryrefslogtreecommitdiff
path: root/lib/Cwd.pm
diff options
context:
space:
mode:
authorMichael G. Schwern <schwern@pobox.com>2003-08-16 07:58:25 -0700
committerJarkko Hietaniemi <jhi@iki.fi>2003-08-17 19:27:03 +0000
commit39741d738e6fb2ee9de47dcf0299296483fa68f1 (patch)
tree27f42606cfcd1455792ea1b7a09232012f127808 /lib/Cwd.pm
parentff882698b6698d58b88207970341d9a7b204c28d (diff)
downloadperl-39741d738e6fb2ee9de47dcf0299296483fa68f1.tar.gz
Taint safe Cwd::_qnx_abs_path()
Message-ID: <20030816215824.GF5859@windhund.schwern.org> (plus local *REALPATH) p4raw-id: //depot/perl@20749
Diffstat (limited to 'lib/Cwd.pm')
-rw-r--r--lib/Cwd.pm15
1 files 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 = <REALPATH>;
+ close REALPATH;
+ chomp $realpath;
return $realpath;
}