iliaa Thu Jul 27 15:37:56 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/main php_variables.c /php-src NEWS Log: Fixed bug #38236 (Binary data gets corrupted on multipart/formdata POST). http://cvs.php.net/viewvc.cgi/php-src/main/php_variables.c?r1=1.104.2.10&r2=1.104.2.10.2.1&diff_format=u Index: php-src/main/php_variables.c diff -u php-src/main/php_variables.c:1.104.2.10 php-src/main/php_variables.c:1.104.2.10.2.1 --- php-src/main/php_variables.c:1.104.2.10 Wed May 3 11:24:29 2006 +++ php-src/main/php_variables.c Thu Jul 27 15:37:56 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_variables.c,v 1.104.2.10 2006/05/03 11:24:29 dmitry Exp $ */ +/* $Id: php_variables.c,v 1.104.2.10.2.1 2006/07/27 15:37:56 iliaa Exp $ */ #include <stdio.h> #include "php.h" @@ -216,31 +216,37 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) { - char *var, *val; - char *strtok_buf = NULL; + char *var, *val, *e, *s, *p; zval *array_ptr = (zval *) arg; if (SG(request_info).post_data == NULL) { return; } - var = php_strtok_r(SG(request_info).post_data, "&", &strtok_buf); + s = SG(request_info).post_data; + e = s + SG(request_info).post_data_length; - while (var) { - val = strchr(var, '='); - if (val) { /* have a value */ + while (s < e && (p = memchr(s, '&', (e - s)))) { +last_value: + if ((val = memchr(s, '=', (p - s)))) { /* have a value */ unsigned int val_len, new_val_len; - *val++ = '\0'; - php_url_decode(var, strlen(var)); - val_len = php_url_decode(val, strlen(val)); + var = s; + + php_url_decode(var, (val - s)); + val++; + val_len = php_url_decode(val, (p - val)); val = estrndup(val, val_len); if (sapi_module.input_filter(PARSE_POST, var, &val, val_len, &new_val_len TSRMLS_CC)) { php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC); } efree(val); } - var = php_strtok_r(NULL, "&", &strtok_buf); + s = p + 1; + } + if (s < e) { + p = e; + goto last_value; } } http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.157&r2=1.2027.2.547.2.158&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.157 php-src/NEWS:1.2027.2.547.2.158 --- php-src/NEWS:1.2027.2.547.2.157 Thu Jul 27 14:00:13 2006 +++ php-src/NEWS Thu Jul 27 15:37:56 2006 @@ -15,6 +15,8 @@ . Fixed bug #37564 (AES privacy encryption not possible due to net-snmp 5.2 compatibility issue). (Patch: scott dot moynes+php at gmail dot com) +- Fixed bug #38236 (Binary data gets corrupted on multipart/formdata POST). + (Ilia) - Fixed bug #38234 (Exception in __clone makes memory leak). (Dmitry, Nuno) - Fixed bug #38229 (strtotime() does not parse YYYY-MM format). (Ilia) - Fixed bug #38224 (session extension can't handle broken cookies). (Ilia)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php