--- parser3/src/classes/form.C 2001/06/28 07:44:17 1.13 +++ parser3/src/classes/form.C 2001/11/05 11:46:20 1.19 @@ -2,12 +2,10 @@ Parser: @b form parser class. Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexander Petrosyan (http://paf.design.ru) - Author: Alexander Petrosyan (http://design.ru/paf) - - $Id: form.C,v 1.13 2001/06/28 07:44:17 parser Exp $ + $Id: form.C,v 1.19 2001/11/05 11:46:20 paf Exp $ */ -static const char *RCSId="$Id: form.C,v 1.13 2001/06/28 07:44:17 parser Exp $"; #include "classes.h" #include "pa_request.h" @@ -59,16 +57,23 @@ void MForm::configure_admin(Request& r) size_t max_post_size=value?value:MAX_POST_SIZE_DEFAULT; if(r.info.content_length>max_post_size) - PTHROW(0, 0, + throw Exception(0, 0, 0, "posted content_length(%u) > max_post_size(%u)", r.post_size, max_post_size); + if(r.info.content_length<0) + throw Exception(0, 0, + 0, + "posted content_length(%u) < 0", + r.post_size); // read POST data - r.post_data=(char *)malloc(r.info.content_length); - r.post_size=SAPI::read_post(pool, r.post_data, r.info.content_length); + if(r.info.content_length) { + r.post_data=(char *)pool.malloc(r.info.content_length); + r.post_size=SAPI::read_post(pool, r.post_data, r.info.content_length); + } if(r.post_size!=r.info.content_length) - PTHROW(0, 0, + throw Exception(0, 0, 0, "post_size(%u)!=content_length(%u)", r.post_size, r.info.content_length);