summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2008-08-30 16:47:46 +0000
committerRasmus Lerdorf <rasmus@php.net>2008-08-30 16:47:46 +0000
commitf52d71d18ed190b4619fc554e495f04d518f3880 (patch)
treef0bdc572e98b2728bf1c5e4d529c8f7ff81b84d0 /main
parent820c2002e4636fd95f07fc903b867fea381092e8 (diff)
downloadphp-git-f52d71d18ed190b4619fc554e495f04d518f3880.tar.gz
Fix for bugs 13961, 39927 and 45947
Diffstat (limited to 'main')
-rw-r--r--main/php_variables.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main/php_variables.c b/main/php_variables.c
index f0d9dc892b..98fdd2efc0 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -57,11 +57,12 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
}
-PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC)
+PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars_array TSRMLS_DC)
{
char *p = NULL;
char *ip; /* index pointer */
char *index, *escaped_index = NULL;
+ char *var, *var_orig;
int var_len, index_len;
zval *gpc_element, **gpc_element_p;
zend_bool is_array = 0;
@@ -87,6 +88,8 @@ PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_arra
* Prepare variable name
*/
+ var_orig = estrdup(var_name);
+ var = var_orig;
/* ignore leading spaces in the variable name */
while (*var && *var==' ') {
var++;
@@ -107,6 +110,7 @@ PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_arra
if (var_len==0) { /* empty variable name, or variable name with a space in it */
zval_dtor(val);
+ efree(var_orig);
return;
}
@@ -115,6 +119,7 @@ PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_arra
var_len == sizeof("GLOBALS")-1 &&
!memcmp(var, "GLOBALS", sizeof("GLOBALS")-1)) {
zval_dtor(val);
+ efree(var_orig);
return;
}
@@ -146,6 +151,7 @@ PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_arra
if (!PG(display_errors)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variable nesting level exceeded %ld. To increase the limit change max_input_nesting_level in php.ini.", PG(max_input_nesting_level));
}
+ efree(var_orig);
return;
}
@@ -237,6 +243,7 @@ plain_var:
}
}
}
+ efree(var_orig);
}
SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)