Advertisement
laruence

Untitled

Jan 4th, 2012
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.05 KB | None | 0 0
  1. Index: main/php_globals.h
  2. ===================================================================
  3. --- main/php_globals.h  (revision 321752)
  4. +++ main/php_globals.h  (working copy)
  5. @@ -146,7 +146,7 @@
  6.     zend_bool com_initialized;
  7.  #endif
  8.     long max_input_nesting_level;
  9. -   long max_input_vars;
  10. +   long max_post_vars;
  11.     zend_bool in_user_include;
  12.  
  13.     char *user_ini_filename;
  14. Index: main/php_variables.c
  15. ===================================================================
  16. --- main/php_variables.c    (revision 321752)
  17. +++ main/php_variables.c    (working copy)
  18. @@ -178,15 +178,10 @@
  19.             } else {
  20.                 escaped_index = index;
  21.                 if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE
  22. -                   || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
  23. -                   if (zend_hash_num_elements(symtable1) <= PG(max_input_vars)) {
  24. -                       if (zend_hash_num_elements(symtable1) == PG(max_input_vars)) {
  25. -                           php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
  26. -                       }
  27. -                       MAKE_STD_ZVAL(gpc_element);
  28. -                       array_init(gpc_element);
  29. -                       zend_symtable_update(symtable1, escaped_index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
  30. -                   }
  31. +                       || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
  32. +                   MAKE_STD_ZVAL(gpc_element);
  33. +                   array_init(gpc_element);
  34. +                   zend_symtable_update(symtable1, escaped_index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
  35.                 }
  36.                 if (index != escaped_index) {
  37.                     efree(escaped_index);
  38. @@ -225,14 +220,7 @@
  39.                 zend_symtable_exists(symtable1, escaped_index, index_len + 1)) {
  40.                 zval_ptr_dtor(&gpc_element);
  41.             } else {
  42. -               if (zend_hash_num_elements(symtable1) <= PG(max_input_vars)) {
  43. -                   if (zend_hash_num_elements(symtable1) == PG(max_input_vars)) {
  44. -                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
  45. -                   }
  46. -                   zend_symtable_update(symtable1, escaped_index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
  47. -               } else {
  48. -                   zval_ptr_dtor(&gpc_element);
  49. -               }
  50. +               zend_symtable_update(symtable1, escaped_index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
  51.             }
  52.             if (escaped_index != index) {
  53.                 efree(escaped_index);
  54. @@ -246,6 +234,7 @@
  55.  {
  56.     char *var, *val, *e, *s, *p;
  57.     zval *array_ptr = (zval *) arg;
  58. +   long num_vars = 0;
  59.  
  60.     if (SG(request_info).post_data == NULL) {
  61.         return;
  62. @@ -271,6 +260,10 @@
  63.             efree(val);
  64.         }
  65.         s = p + 1;
  66. +       if (++num_vars >= PG(max_post_vars)) {
  67. +           php_error_docref(NULL TSRMLS_CC, E_WARNING, "Post variables exceeded %ld. To increase the limit change max_post_vars in php.ini.", PG(max_post_vars));
  68. +           return;
  69. +       }
  70.     }
  71.     if (s < e) {
  72.         p = e;
  73. Index: main/main.c
  74. ===================================================================
  75. --- main/main.c (revision 321752)
  76. +++ main/main.c (working copy)
  77. @@ -531,7 +531,7 @@
  78.     STD_PHP_INI_ENTRY("post_max_size",          "8M",       PHP_INI_SYSTEM|PHP_INI_PERDIR,      OnUpdateLong,           post_max_size,          sapi_globals_struct,sapi_globals)
  79.     STD_PHP_INI_ENTRY("upload_tmp_dir",         NULL,       PHP_INI_SYSTEM,     OnUpdateStringUnempty,  upload_tmp_dir,         php_core_globals,   core_globals)
  80.     STD_PHP_INI_ENTRY("max_input_nesting_level", "64",      PHP_INI_SYSTEM|PHP_INI_PERDIR,      OnUpdateLongGEZero, max_input_nesting_level,            php_core_globals,   core_globals)
  81. -   STD_PHP_INI_ENTRY("max_input_vars",         "1000",     PHP_INI_SYSTEM|PHP_INI_PERDIR,      OnUpdateLongGEZero, max_input_vars,             php_core_globals,   core_globals)
  82. +   STD_PHP_INI_ENTRY("max_post_vars",          "1000",     PHP_INI_SYSTEM|PHP_INI_PERDIR,      OnUpdateLongGEZero, max_post_vars,              php_core_globals,   core_globals)
  83.  
  84.     STD_PHP_INI_ENTRY("user_dir",               NULL,       PHP_INI_SYSTEM,     OnUpdateString,         user_dir,               php_core_globals,   core_globals)
  85.     STD_PHP_INI_ENTRY("variables_order",        "EGPCS",    PHP_INI_SYSTEM|PHP_INI_PERDIR,      OnUpdateStringUnempty,  variables_order,        php_core_globalscore_globals)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement