diff options
author | Michael G. Schwern <schwern@pobox.com> | 2002-06-19 12:51:56 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-06-19 20:33:16 +0000 |
commit | 640876195dd7102230f531813a79882745bbbd46 (patch) | |
tree | c779147223af1af695b9f6d7ff6ae3c06b9cf50c /ext | |
parent | 54f8c77382e6d92f19c4cf5463ad7c86c868a545 (diff) | |
download | perl-640876195dd7102230f531813a79882745bbbd46.tar.gz |
Re: [PATCH] POSIX taint tests
Message-id: <20020619205156.GH1232@ool-18b93024.dyn.optonline.net>
p4raw-id: //depot/perl@17308
Diffstat (limited to 'ext')
-rw-r--r-- | ext/POSIX/t/taint.t | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/ext/POSIX/t/taint.t b/ext/POSIX/t/taint.t index 2fc171b182..fcc52c2d29 100644 --- a/ext/POSIX/t/taint.t +++ b/ext/POSIX/t/taint.t @@ -10,9 +10,8 @@ BEGIN { } } -require "./test.pl"; +use Test::More tests => 7; use Scalar::Util qw/tainted/; -plan(tests => 5); use POSIX qw(fcntl_h open read mkfifo); @@ -30,18 +29,23 @@ my $testfd; my $TAINT = substr($^X, 0, 0); eval { mkfifo($TAINT. "TEST", 0) }; -ok($@ =~ /^Insecure dependency/, 'mkfifo with tainted data'); +like($@, qr/^Insecure dependency/, 'mkfifo with tainted data'); eval { $testfd = open($TAINT. "TEST", O_WRONLY, 0) }; -ok($@ =~ /^Insecure dependency/, 'open with tainted data'); +like($@, qr/^Insecure dependency/, 'open with tainted data'); eval { $testfd = open("TEST", O_RDONLY, 0) }; -ok($@ eq "", 'open with untainted data'); +is($@, "", 'open with untainted data'); read($testfd, $buffer, 2) if $testfd > 2; is( $buffer, "#!", ' read' ); ok(tainted($buffer), ' scalar tainted'); -read($testfd, $buffer[1], 2) if $testfd > 2; -#is( $buffer[1], "./", ' read' ); -#ok(tainted($buffer[1]), ' array element tainted'); +TODO: { + local $TODO = "POSIX::read won't taint an array element"; + + read($testfd, $buffer[1], 2) if $testfd > 2; + + is( $buffer[1], "./", ' read' ); + ok(tainted($buffer[1]), ' array element tainted'); +} |