cvs: php4(PHP_4_2_0) /main rfc1867.c

From: Date: Sat, 17 Aug 2002 12:01:29 +0000
Subject: cvs: php4(PHP_4_2_0) /main rfc1867.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13432@lists.php.net to get a copy of this message
sesser Sat Aug 17 08:01:29 2002 EDT Modified files: (Branch: PHP_4_2_0) /php4/main rfc1867.c Log: MFH Index: php4/main/rfc1867.c diff -u php4/main/rfc1867.c:1.94.2.11 php4/main/rfc1867.c:1.94.2.12 --- php4/main/rfc1867.c:1.94.2.11 Mon Jul 15 12:40:57 2002 +++ php4/main/rfc1867.c Sat Aug 17 08:01:28 2002 @@ -16,7 +16,7 @@ | Jani Taskinen <sniper@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: rfc1867.c,v 1.94.2.11 2002/07/15 16:40:57 sesser Exp $ */ +/* $Id: rfc1867.c,v 1.94.2.12 2002/08/17 12:01:28 sesser Exp $ */ /* * This product includes software developed by the Apache Group @@ -608,7 +608,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) { - char *boundary, *s=NULL, *start_arr=NULL, *array_index=NULL; + char *boundary, *boundary_end=NULL, *s=NULL, *start_arr=NULL, *array_index=NULL; char *temp_filename=NULL, *lbuf=NULL, *abuf=NULL; int boundary_len=0, total_bytes=0, cancel_upload=0, is_arr_upload=0, array_len=0, max_file_size=0; zval *http_post_files=NULL; @@ -632,14 +632,20 @@ boundary++; boundary_len = strlen(boundary); - if (boundary[0] == '"' && boundary[boundary_len-1] == '"') { - if (boundary_len < 2) { /* otherwise a single " passes */ + if (boundary[0] == '"') { + boundary++; + boundary_end = strchr(boundary, '"'); + if (!boundary_end) { sapi_module.sapi_error(E_WARNING, "Invalid boundary in multipart/form-data POST data"); return; } - boundary++; - boundary_len -= 2; - boundary[boundary_len] = '\0'; + } else { + /* search for the end of the boundary */ + boundary_end = strchr(boundary, ','); + } + if (boundary_end) { + boundary_end[0] = '\0'; + boundary_len = boundary_end-boundary; } /* Initialize the buffer */

« previous php.cvs (#13432) next »