rasmus          Sat Aug 30 16:50:25 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/main       php_variables.c 
  Log:
  Fix for bugs 13961, 39927 and 45947
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/php_variables.c?r1=1.104.2.10.2.12&r2=1.104.2.10.2.13&diff_format=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.104.2.10.2.12 
php-src/main/php_variables.c:1.104.2.10.2.13
--- php-src/main/php_variables.c:1.104.2.10.2.12        Mon Dec 31 07:20:15 2007
+++ php-src/main/php_variables.c        Sat Aug 30 16:50:24 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_variables.c,v 1.104.2.10.2.12 2007/12/31 07:20:15 sebastian Exp $ 
*/
+/* $Id: php_variables.c,v 1.104.2.10.2.13 2008/08/30 16:50:24 rasmus Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -57,11 +57,12 @@
        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;
@@ -84,6 +85,8 @@
         * Prepare variable name
         */
 
+       var_orig = estrdup(var_name);
+       var = var_orig;
        /* ignore leading spaces in the variable name */
        while (*var && *var==' ') {
                var++;
@@ -104,6 +107,7 @@
 
        if (var_len==0) { /* empty variable name, or variable name with a space 
in it */
                zval_dtor(val);
+               efree(var_orig);
                return;
        }
 
@@ -112,6 +116,7 @@
                var_len == sizeof("GLOBALS")-1 &&
                !memcmp(var, "GLOBALS", sizeof("GLOBALS")-1)) {
                zval_dtor(val);
+               efree(var_orig);
                return;
        }
 
@@ -142,6 +147,7 @@
                                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;
                        }
 
@@ -233,6 +239,7 @@
                        }
                }
        }
+       efree(var_orig);
 }
 
 SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to