com php-src: duplicate value's string for the SAPI filter: main/php_variables.c
| From: | Michael Wallner | Date: | Tue, 09 Sep 2014 04:54:23 +0000 |
| Subject: | com php-src: duplicate value's string for the SAPI filter: main/php_variables.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81471@lists.php.net to get a copy of this message | ||
Commit: 8d1099ac0574f3a42036085641c2df03a1d5f731
Author: Michael Wallner <mike@php.net> Tue, 9 Sep 2014 06:54:23 +0200
Parents: 4bdd9aabdd9ddabac9fe253aab4c8366691c5171
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8d1099ac0574f3a42036085641c2df03a1d5f731
Log:
duplicate value's string for the SAPI filter
reported by sesser; tyrael, do you take care of the bug/NEWS?
Changed paths:
M main/php_variables.c
Diff:
diff --git a/main/php_variables.c b/main/php_variables.c
index 90cfcb2..b2df88b 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -241,7 +241,7 @@ typedef struct post_var_data {
static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof TSRMLS_DC)
{
- char *ksep, *vsep;
+ char *ksep, *vsep, *val;
size_t klen, vlen;
/* FIXME: string-size_t */
unsigned int new_vlen;
@@ -272,15 +272,17 @@ static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof
TSR
vlen = 0;
}
-
php_url_decode(var->ptr, klen);
+
+ val = estrndup(ksep, vlen);
if (vlen) {
- vlen = php_url_decode(ksep, vlen);
+ vlen = php_url_decode(val, vlen);
}
- if (sapi_module.input_filter(PARSE_POST, var->ptr, &ksep, vlen, &new_vlen TSRMLS_CC)) {
- php_register_variable_safe(var->ptr, ksep, new_vlen, arr TSRMLS_CC);
+ if (sapi_module.input_filter(PARSE_POST, var->ptr, &val, vlen, &new_vlen TSRMLS_CC)) {
+ php_register_variable_safe(var->ptr, val, new_vlen, arr TSRMLS_CC);
}
+ efree(val);
var->ptr = vsep + (vsep != var->end);
return 1;