1b39c5158Smillert#!./perl -Tw 2b39c5158Smillert# [perl #33173] shellwords.pl and tainting 3b39c5158Smillert 4*256a93a4Safresh1use strict; 5*256a93a4Safresh1use warnings; 6*256a93a4Safresh1 76fb12b70Safresh1BEGIN { 86fb12b70Safresh1 if ( $ENV{PERL_CORE} ) { 96fb12b70Safresh1 require Config; 106fb12b70Safresh1 no warnings 'once'; 116fb12b70Safresh1 if ($Config::Config{extensions} !~ /\bList\/Util\b/) { 126fb12b70Safresh1 print "1..0 # Skip: Scalar::Util was not built\n"; 136fb12b70Safresh1 exit 0; 146fb12b70Safresh1 } 15*256a93a4Safresh1 if (exists($Config::Config{taint_support}) && not $Config::Config{taint_support}) { 16*256a93a4Safresh1 print "1..0 # Skip: your perl was built without taint support\n"; 17*256a93a4Safresh1 exit 0; 18*256a93a4Safresh1 } 196fb12b70Safresh1 } 206fb12b70Safresh1} 216fb12b70Safresh1 22b39c5158Smillertuse Text::ParseWords qw(shellwords old_shellwords); 23b39c5158Smillertuse Scalar::Util qw(tainted); 24b39c5158Smillert 25b39c5158Smillertprint "1..2\n"; 26b39c5158Smillert 27b39c5158Smillertprint "not " if grep { not tainted($_) } shellwords("$0$^X"); 28b39c5158Smillertprint "ok 1\n"; 29b39c5158Smillert 30b39c5158Smillertprint "not " if grep { not tainted($_) } old_shellwords("$0$^X"); 31b39c5158Smillertprint "ok 2\n"; 32