in reply to Unlink under taint mode
I can't immediately see the problem with your code, but what I would do is to use the tainted function from Scalar::Util to pinpoint the exactly which variable is giving you trouble.
BTW, to avoid . and .., all you need to do is
or better yetmy @files = map untaint( $_ ), grep !/^\.\.?$/, readdir DIR;
Also, the regexp in your untaint function could be written more economically asmy @files = map untaint( $_ ), grep -f "$dir/$_", readdir DIR;
\w already implies _, and there's no need to escape - (nor _ BTW) inside the [ ] as long as it is the first or the last character in the group (e.g. [-AZ] matches -, A, and Z.)./([\w-]+)/
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Follow up
by Andre_br (Pilgrim) on Apr 10, 2005 at 02:12 UTC | |
by tlm (Prior) on Apr 10, 2005 at 02:31 UTC |