in reply to Re^3: a small regexp question
in thread a small regexp question
Which is, you must admit much more likely than forming a string and passing it to eval (but some people do some amazingly unsecure things). Of course, if they pass it through the qr operator, we're back in business. (I assume they aren't using the obviously insecure use re 'eval';)my $string = "a_sample_string"; my $re = q[(?{ tr|_| | })(.*)]; # or my $re = some CGI parameter extraction $string =~ m/$re/; print $1;
The lesson here for anyone writing CGI scripts that do regexp manipulation is this:
Using qr allows regexps to execute arbitrary code. DO NOT take arbitrary user input and feed it to qr unless you mean to allow arbitrary code execution.
-- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/
|
|---|