tony2001 Tue Jun 5 11:24:13 2007 UTC Modified files: /php-src/main php_variables.c Log: port the max_input_nesting_level ini option to Unicode mode http://cvs.php.net/viewvc.cgi/php-src/main/php_variables.c?r1=1.141&r2=1.142&diff_format=u Index: php-src/main/php_variables.c diff -u php-src/main/php_variables.c:1.141 php-src/main/php_variables.c:1.142 --- php-src/main/php_variables.c:1.141 Mon Jun 4 07:56:39 2007 +++ php-src/main/php_variables.c Tue Jun 5 11:24:13 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_variables.c,v 1.141 2007/06/04 07:56:39 tony2001 Exp $ */ +/* $Id: php_variables.c,v 1.142 2007/06/05 11:24:13 tony2001 Exp $ */ #include <stdio.h> #include "php.h" @@ -275,12 +275,30 @@ index = var; index_len = var_len; - while (1) { - if (is_array) { + if (is_array) { + int nest_level = 0; + while (1) { zstr escaped_index = NULL_ZSTR; UChar *index_s; int new_idx_len = 0; + if(++nest_level > PG(max_input_nesting_level)) { + HashTable *ht; + zstr tmp_var; + /* too many levels of nesting */ + + ht = Z_ARRVAL_P(track_vars_array); + + tmp_var.u = var; + zend_u_hash_del(ht, IS_UNICODE, tmp_var, var_len + 1); + zval_dtor(val); + + 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)); + } + return; + } + ip++; index_s = ip; if (u_isspace(*ip)) { @@ -334,23 +352,22 @@ } else { is_array = 0; } - } else { + } + } else { plain_var: - MAKE_STD_ZVAL(gpc_element); - gpc_element->value = val->value; - Z_TYPE_P(gpc_element) = Z_TYPE_P(val); - if (!index) { - zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); - } else { - /* UTODO fix for php_addslashes case */ - //char *escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); - zstr escaped_index; - - escaped_index.u = index; - zend_u_symtable_update(symtable1, IS_UNICODE, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); - //efree(escaped_index); - } - break; + MAKE_STD_ZVAL(gpc_element); + gpc_element->value = val->value; + Z_TYPE_P(gpc_element) = Z_TYPE_P(val); + if (!index) { + zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + } else { + /* UTODO fix for php_addslashes case */ + //char *escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); + zstr escaped_index; + + escaped_index.u = index; + zend_u_symtable_update(symtable1, IS_UNICODE, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + //efree(escaped_index); } } }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php