in reply to Plz help w/ taint issue while copying dir contents
It's perfectly OK to have - in your untainting regexp, e.g.
Note that within a character class, - must either be escaped, or else appear in the first or last position in the character list, otherwise it is interpreted as a range indicator (see Version 8 Regular Expressions in perlre).sub untaint { my $var = $_[0]; my ($untained_file) = $var =~ /^([\w-]+)$/ or die "bad filename: $ +var"; return $untained_file; }
Also, if you're using locale, read this node.
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Plz help w/ taint issue while copying dir contents
by Stenyj (Beadle) on Apr 12, 2005 at 03:27 UTC | |
by tlm (Prior) on Apr 12, 2005 at 03:41 UTC |