--- parser3/src/classes/form.C 2001/09/26 10:32:25 1.16 +++ parser3/src/classes/form.C 2001/10/19 12:43:29 1.18 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: form.C,v 1.16 2001/09/26 10:32:25 parser Exp $ + $Id: form.C,v 1.18 2001/10/19 12:43:29 parser Exp $ */ #include "classes.h" @@ -57,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 *)pool.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);