From: foobar Date: Mon, 1 Apr 2002 23:29:19 +0000 (+0000) Subject: MFH X-Git-Tag: php-4.2.0RC2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c622d749522feab3688ec6436a2697d73114aa5f;p=php MFH --- diff --git a/main/rfc1867.c b/main/rfc1867.c index 97f7399598..5c997cda6a 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -591,12 +591,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) FILE *fp; zend_llist header; - - if (!PG(file_uploads)) { - sapi_module.sapi_error(E_WARNING, "File uploads are disabled"); - return; - } - if (SG(request_info).content_length > SG(post_max_size)) { sapi_module.sapi_error(E_WARNING, "POST Content-Length of %d bytes exceeds the limit of %d bytes", SG(request_info).content_length, SG(post_max_size)); return; @@ -707,6 +701,20 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) continue; } + /* If file_uploads=off, skip the file part */ + if (!PG(file_uploads)) { + efree(filename); + if (param) efree(param); + continue; + } + + /* Return with an error if the posted data is garbled */ + if (!param) { + sapi_module.sapi_error(E_WARNING, "File Upload Mime headers garbled"); + efree(filename); + SAFE_RETURN; + } + /* Handle file */ fp = php_open_temporary_file(PG(upload_tmp_dir), "php", &temp_filename TSRMLS_CC); if (!fp) {