rasmus          Sat Aug 30 16:47:46 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /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.11.2.5&r2=1.104.2.10.2.11.2.6&diff_format=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.104.2.10.2.11.2.5 
php-src/main/php_variables.c:1.104.2.10.2.11.2.6
--- php-src/main/php_variables.c:1.104.2.10.2.11.2.5    Tue Apr 29 08:15:20 2008
+++ php-src/main/php_variables.c        Sat Aug 30 16:47:46 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_variables.c,v 1.104.2.10.2.11.2.5 2008/04/29 08:15:20 dmitry Exp $ 
*/
+/* $Id: php_variables.c,v 1.104.2.10.2.11.2.6 2008/08/30 16:47:46 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;
@@ -87,6 +88,8 @@
         * 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 @@
 
        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 @@
                var_len == sizeof("GLOBALS")-1 &&
                !memcmp(var, "GLOBALS", sizeof("GLOBALS")-1)) {
                zval_dtor(val);
+               efree(var_orig);
                return;
        }
 
@@ -146,6 +151,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;
                        }
 
@@ -237,6 +243,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