Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: CGI::Application and CGI security

by derby (Abbot)
on Jun 30, 2004 at 17:34 UTC ( [id://370824]=note: print w/replies, xml ) Need Help??


in reply to Re: CGI::Application and CGI security
in thread CGI::Application and CGI security

Interesting ... from the CGI docs:
$CGI::POST_MAX If set to a non-negative integer, this variable puts a ceiling on the size of POSTings ... An attempt to send a POST larger than $POST_MAX bytes will cause param() to return an empty CGI parameter list. You can test for this event by checking cgi_error(),
However looking at the CGI code ($CGI::VERSION=3.05;), I see the following check:

METHOD: { # avoid unreasonably large postings if (($POST_MAX > 0) && ($content_length > $POST_MAX)) { # quietly read and discard the post my $buffer; my $max = $content_length; while ($max > 0 && (my $bytes = $MOD_PERL ? $self->r->read($buffer,$max < 10000 ? $max : 10000) : read(STDIN,$buffer,$max < 10000 ? $max : 10000) )) { $self->cgi_error("413 Request entity too large"); last METHOD; } }
I think that would be a bug in CGI.pm (anyone want to tell Lincoln). It seems to me that the line should be
if (($POST_MAX > -1 ) && ($content_length > $POST_MAX))
but then again ... setting $CGI::POST_MAX to 0 is kinda silly in a real world context.

-derby

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://370824]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-18 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found