rasmus          Sat Aug 30 16:53:05 2008 UTC

  Modified files:              
    /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.147&r2=1.148&diff_format=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.147 php-src/main/php_variables.c:1.148
--- php-src/main/php_variables.c:1.147  Sun Aug  3 12:12:45 2008
+++ php-src/main/php_variables.c        Sat Aug 30 16:53:05 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_variables.c,v 1.147 2008/08/03 12:12:45 jani Exp $ */
+/* $Id: php_variables.c,v 1.148 2008/08/30 16:53:05 rasmus Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -66,11 +66,12 @@
        php_u_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;
+       char *var, *var_orig;
        int var_len, index_len;
        zval *gpc_element, **gpc_element_p;
        zend_bool is_array = 0;
@@ -92,6 +93,8 @@
         * Prepare variable name
         */
 
+       var_orig = estrdup(var_name);
+       var = var_orig;
        /* ignore leading spaces in the variable name */
        while (*var && *var==' ') {
                var++;
@@ -112,6 +115,7 @@
 
        if (var_len==0) { /* empty variable name, or variable name with a space 
in it */
                zval_dtor(val);
+               efree(var_orig);
                return;
        }
 
@@ -120,6 +124,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;
                        }
 
@@ -221,6 +227,7 @@
                        }
                }
        }
+       efree(var_orig);
 }
 
 PHPAPI void php_u_register_variable_ex(UChar *var, zval *val, zval 
*track_vars_array TSRMLS_DC)



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

Reply via email to