6 require Config; import Config;
7 if ($^O ne 'VMS' and $Config{'extensions'} !~ /\bPOSIX\b/) {
14 use Scalar::Util qw/tainted/;
18 use POSIX qw(fcntl_h open read mkfifo);
28 # The empty tainted value, for tainting strings
30 my $TAINT = substr($^X, 0, 0);
32 eval { mkfifo($TAINT. "TEST", 0) };
33 ok($@ =~ /^Insecure dependency/, 'mkfifo with tainted data');
35 eval { $testfd = open($TAINT. "TEST", O_WRONLY, 0) };
36 ok($@ =~ /^Insecure dependency/, 'open with tainted data');
38 eval { $testfd = open("TEST", O_RDONLY, 0) };
39 ok($@ eq "", 'open with untainted data');
41 read($testfd, $buffer, 2) if $testfd > 2;
42 is( $buffer, "#!", ' read' );
43 ok(tainted($buffer), ' scalar tainted');
44 read($testfd, $buffer[1], 2) if $testfd > 2;
46 #is( $buffer[1], "./", ' read' );
47 #ok(tainted($buffer[1]), ' array element tainted');