1#!./perl -T 2 3BEGIN { 4 unless(grep /blib/, @INC) { 5 chdir 't' if -d 't'; 6 @INC = '../lib'; 7 } 8} 9 10use Config; 11 12BEGIN { 13 if(-d "lib" && -f "TEST") { 14 if ($Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS') { 15 print "1..0\n"; 16 exit 0; 17 } 18 } 19} 20 21END { unlink "./__taint__$$" } 22 23print "1..3\n"; 24use IO::File; 25$x = new IO::File "> ./__taint__$$" || die("Cannot open ./__taint__$$\n"); 26print $x "$$\n"; 27$x->close; 28 29$x = new IO::File "< ./__taint__$$" || die("Cannot open ./__taint__$$\n"); 30chop($unsafe = <$x>); 31eval { kill 0 * $unsafe }; 32print "not " if ((($^O ne 'MSWin32') && ($^O ne 'NetWare')) and ($@ !~ /^Insecure/o)); 33print "ok 1\n"; 34$x->close; 35 36# We could have just done a seek on $x, but technically we haven't tested 37# seek yet... 38$x = new IO::File "< ./__taint__$$" || die("Cannot open ./__taint__$$\n"); 39$x->untaint; 40print "not " if ($?); 41print "ok 2\n"; # Calling the method worked 42chop($unsafe = <$x>); 43eval { kill 0 * $unsafe }; 44print "not " if ($@ =~ /^Insecure/o); 45print "ok 3\n"; # No Insecure message from using the data 46$x->close; 47 48exit 0; 49