diff options
author | Michael G. Schwern <schwern@pobox.com> | 2003-08-15 11:43:45 -0700 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-08-16 19:32:05 +0000 |
commit | 3ee63918b283f8dc009c331f172f83c394ed2bb6 (patch) | |
tree | 847b41e77e42a18c192104bccb62859509b07f7e /ext/Cwd | |
parent | 8ba6e8771826736d13e898ab45244fa6368c8f05 (diff) | |
download | perl-3ee63918b283f8dc009c331f172f83c394ed2bb6.tar.gz |
Taint problems in Cwd::abs_path
Message-ID: <20030816014345.GE4023@windhund.schwern.org>
p4raw-id: //depot/perl@20734
Diffstat (limited to 'ext/Cwd')
-rw-r--r-- | ext/Cwd/t/taint.t | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/ext/Cwd/t/taint.t b/ext/Cwd/t/taint.t index 3f6aa5290d..2cd7d19ae6 100644 --- a/ext/Cwd/t/taint.t +++ b/ext/Cwd/t/taint.t @@ -3,22 +3,23 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + unshift @INC, '../lib'; } +use strict; use Cwd; -use Test::More tests => 6; +use Test::More tests => 16; use Scalar::Util qw/tainted/; -my $cwd; -eval { $cwd = getcwd; }; -is( $@, '', 'getcwd() does not explode under taint mode' ); -ok( tainted($cwd), "its return value is tainted" ); +my @Functions = qw(getcwd cwd fastcwd fastgetcwd + abs_path fast_abs_path + realpath fast_realpath + ); -eval { $cwd = cwd; }; -is( $@, '', 'cwd() does not explode under taint mode' ); -ok( tainted($cwd), "its return value is tainted" ); - -eval { $cwd = fastcwd; }; -is( $@, '', 'fastcwd() does not explode under taint mode' ); -ok( tainted($cwd), "its return value is tainted" ); +foreach my $func (@Functions) { + no strict 'refs'; + my $cwd; + eval { $cwd = &{'Cwd::'.$func} }; + is( $@, '', "$func() does not explode under taint mode" ); + ok( tainted($cwd), "its return value is tainted" ); +} |