jcpunk has asked for the wisdom of the Perl Monks concerning the following question:
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});
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: taint check that I thought worked
by cbro (Pilgrim) on Feb 02, 2004 at 17:03 UTC | |
|
Re: taint check that I thought worked
by hardburn (Abbot) on Feb 02, 2004 at 19:12 UTC | |
|
Re: taint check that I thought worked
by welchavw (Pilgrim) on Feb 02, 2004 at 17:04 UTC | |
by ysth (Canon) on Feb 02, 2004 at 17:18 UTC | |
by ambrus (Abbot) on Feb 03, 2004 at 10:58 UTC | |
by ysth (Canon) on Feb 03, 2004 at 16:06 UTC | |
|
Re: taint check that I thought worked
by ysth (Canon) on Feb 02, 2004 at 17:05 UTC | |
|
Re: taint check that I thought worked
by Fletch (Bishop) on Feb 02, 2004 at 17:06 UTC | |
|
Re: taint check that I thought worked
by Not_a_Number (Prior) on Feb 02, 2004 at 19:35 UTC |