in reply to Safely passing CGI form data to a shell command
I would require that those terms passed the most restrictive regexp (maybe /^[a-z']+$/i) that would capture the arguments to dict. I.e., adding your whitespace stripping:
(NB: I have not confirmed that /^[a-z]+$/i indeed matches all valid arguments to dict.)my @untainted = grep $_, map { s/^\s*([a-z']+)\s*$/$1/i; $_ } @terms;
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Safely passing CGI form data to a shell command
by Tommy (Chaplain) on Apr 21, 2005 at 17:16 UTC |