lib.pl ------------- package lib; use vars '%common'; %common = ( 'username' => " " ); sub untaint_username { my $tainted = shift; # patern match letters and numbers for 1-16 characters (inclusive) $tainted =~ s/\W//g; # remove all non word characters if ($tainted =~ /\A([a-zA-Z0-9]{1-16})\z/i) { return $1; } # behold a username else {print "failure\n";} } 1;
I dont think that anything weird is going on, so I guess the expression doesnt match what I think it does.----------------- prog.pl ----------------- #!/usr/bin/perl -wT use strict; require './lib.pl'; $lib::common{username}="unixhelp"; $lib::common{username}=lib::untaint_username($lib::common{username});
In reply to taint check that I thought worked by jcpunk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |