Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Unexpected "text/plain" output with cgi

by enoch (Chaplain)
on Nov 13, 2002 at 17:48 UTC ( #212645=note: print w/replies, xml ) Need Help??


in reply to Unexpected "text/plain" output with cgi

Since no one has pointed it out, yet, you really really, really do not want to do:
if ($page) { &$page; }
What if someone (and, don't do this) passed in the URL http://www.robotskull.com/cgi-bin/index.cgi?page=kittens;`rm -rf /etc` (or worse). A better way would be to:
if($page) { SWITCH: { &kitten, last SWITCH if($page eq 'kitten'); &foo, last SWITCH if($page eq 'foo'); &bar, last SWITCH if($page eq 'bar'); . . . print STDERR "invalid CGI parameter", last SWITCH; } }

Enoch

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://212645]
help
Chatterbox?
[karlgoethebier]: Discipulus: i don't know. no msdog at hand no more
[Eily]: Discipulus I get the same thing on strawberry perl v5.20
[Eily]: hu, it came with 5.22 ...
Discipulus win32 is the vietnam of envs..
[Eily]: what's your perl version Discipulus ?
[karlgoethebier]: Eily, Discipulus : IMHO it's worth to ask in SoPW

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2017-07-21 08:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (319 votes). Check out past polls.