summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2012-02-17 12:10:08 +0100
committerOndřej Surý <ondrej@sury.org>2012-02-17 12:10:08 +0100
commitf89bb30da3cd51ee2deb566a08e318d6c3995324 (patch)
treeb402687176685db240a0043af98b91f8f8b3737f /main
parent5292df2401c781de56fd04835c18e11162152626 (diff)
downloadphp-f89bb30da3cd51ee2deb566a08e318d6c3995324.tar.gz
Imported Upstream version 5.4.0~rc8upstream/5.4.0_rc8
Diffstat (limited to 'main')
-rw-r--r--main/main.c4
-rw-r--r--main/output.c18
-rw-r--r--main/php_compat.h3
-rw-r--r--main/php_variables.c37
-rw-r--r--main/php_version.h4
-rw-r--r--main/rfc1867.c29
6 files changed, 51 insertions, 44 deletions
diff --git a/main/main.c b/main/main.c
index fe5271153..230146096 100644
--- a/main/main.c
+++ b/main/main.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c 322964 2012-01-31 09:58:26Z mike $ */
+/* $Id: main.c 323245 2012-02-16 01:51:45Z stas $ */
/* {{{ includes
*/
@@ -1999,10 +1999,8 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
zuf.write_function = php_output_wrapper;
zuf.fopen_function = php_fopen_wrapper_for_zend;
zuf.message_handler = php_message_handler_for_zend;
-#ifndef ZEND_SIGNALS
zuf.block_interruptions = sapi_module.block_interruptions;
zuf.unblock_interruptions = sapi_module.unblock_interruptions;
-#endif
zuf.get_configuration_directive = php_get_configuration_directive_for_zend;
zuf.ticks_function = php_run_ticks;
zuf.on_timeout = php_on_timeout;
diff --git a/main/output.c b/main/output.c
index 2ff575606..092d2b902 100644
--- a/main/output.c
+++ b/main/output.c
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: output.c 322964 2012-01-31 09:58:26Z mike $ */
+/* $Id: output.c 323219 2012-02-14 19:31:54Z mike $ */
#ifndef PHP_OUTPUT_DEBUG
# define PHP_OUTPUT_DEBUG 0
@@ -1260,11 +1260,19 @@ static int php_output_handler_compat_func(void **handler_context, php_output_con
PHP_OUTPUT_TSRMLS(output_context);
if (func) {
- uint safe_out_len;
+ char *out_str = NULL;
+ uint out_len = 0;
+
+ func(output_context->in.data, output_context->in.used, &out_str, &out_len, output_context->op TSRMLS_CC);
+
+ if (out_str) {
+ output_context->out.data = out_str;
+ output_context->out.used = out_len;
+ output_context->out.free = 1;
+ } else {
+ php_output_context_pass(output_context);
+ }
- func(output_context->in.data, output_context->in.used, &output_context->out.data, &safe_out_len, output_context->op TSRMLS_CC);
- output_context->out.used = safe_out_len;
- output_context->out.free = 1;
return SUCCESS;
}
return FAILURE;
diff --git a/main/php_compat.h b/main/php_compat.h
index e53d30b5b..0121babf8 100644
--- a/main/php_compat.h
+++ b/main/php_compat.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_compat.h 321634 2012-01-01 13:15:04Z felipe $ */
+/* $Id: php_compat.h 323096 2012-02-06 18:11:56Z rasmus $ */
#ifndef PHP_COMPAT_H
#define PHP_COMPAT_H
@@ -34,7 +34,6 @@
#define pcre_exec php_pcre_exec
#define pcre_get_substring php_pcre_get_substring
#define pcre_get_substring_list php_pcre_get_substring_list
-#define pcre_info php_pcre_info
#define pcre_maketables php_pcre_maketables
#define pcre_study php_pcre_study
#define pcre_version php_pcre_version
diff --git a/main/php_variables.c b/main/php_variables.c
index c34ad4ec3..9ad7a96a4 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_variables.c 323013 2012-02-02 10:26:53Z dmitry $ */
+/* $Id: php_variables.c 323202 2012-02-14 08:58:52Z dmitry $ */
#include <stdio.h>
#include "php.h"
@@ -183,18 +183,9 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
} else {
if (zend_symtable_find(symtable1, index, index_len + 1, (void **) &gpc_element_p) == FAILURE
|| Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
- if (zend_hash_num_elements(symtable1) <= PG(max_input_vars)) {
- if (zend_hash_num_elements(symtable1) == PG(max_input_vars)) {
- 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));
- }
- MAKE_STD_ZVAL(gpc_element);
- array_init(gpc_element);
- zend_symtable_update(symtable1, index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- } else {
- zval_dtor(val);
- free_alloca(var_orig, use_heap);
- return;
- }
+ MAKE_STD_ZVAL(gpc_element);
+ array_init(gpc_element);
+ zend_symtable_update(symtable1, index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
}
}
symtable1 = Z_ARRVAL_PP(gpc_element_p);
@@ -231,14 +222,7 @@ plain_var:
zend_symtable_exists(symtable1, index, index_len + 1)) {
zval_ptr_dtor(&gpc_element);
} else {
- if (zend_hash_num_elements(symtable1) <= PG(max_input_vars)) {
- if (zend_hash_num_elements(symtable1) == PG(max_input_vars)) {
- 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));
- }
- zend_symtable_update(symtable1, index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- } else {
- zval_ptr_dtor(&gpc_element);
- }
+ zend_symtable_update(symtable1, index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
}
}
}
@@ -249,6 +233,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)
{
char *var, *val, *e, *s, *p;
zval *array_ptr = (zval *) arg;
+ long count = 0;
if (SG(request_info).post_data == NULL) {
return;
@@ -262,6 +247,10 @@ last_value:
if ((val = memchr(s, '=', (p - s)))) { /* have a value */
unsigned int val_len, new_val_len;
+ if (++count > PG(max_input_vars)) {
+ 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));
+ return;
+ }
var = s;
php_url_decode(var, (val - s));
@@ -295,6 +284,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
zval *array_ptr;
int free_buffer = 0;
char *strtok_buf = NULL;
+ long count = 0;
switch (arg) {
case PARSE_POST:
@@ -384,6 +374,11 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
}
}
+ if (++count > PG(max_input_vars)) {
+ 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));
+ break;
+ }
+
if (val) { /* have a value */
int val_len;
unsigned int new_val_len;
diff --git a/main/php_version.h b/main/php_version.h
index f3d841ca5..6c6f76b93 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -3,6 +3,6 @@
#define PHP_MAJOR_VERSION 5
#define PHP_MINOR_VERSION 4
#define PHP_RELEASE_VERSION 0
-#define PHP_EXTRA_VERSION "RC7"
-#define PHP_VERSION "5.4.0RC7"
+#define PHP_EXTRA_VERSION "RC8"
+#define PHP_VERSION "5.4.0RC8"
#define PHP_VERSION_ID 50400
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 23546ee11..19d643bb7 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c 321664 2012-01-01 23:54:25Z stas $ */
+/* $Id: rfc1867.c 323202 2012-02-14 08:58:52Z dmitry $ */
/*
* This product includes software developed by the Apache Group
@@ -691,6 +691,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
php_rfc1867_getword_t getword;
php_rfc1867_getword_conf_t getword_conf;
php_rfc1867_basename_t _basename;
+ long count = 0;
if (php_rfc1867_encoding_translation(TSRMLS_C) && internal_encoding) {
getword = php_rfc1867_getword;
@@ -861,7 +862,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
}
- if (sapi_module.input_filter(PARSE_POST, param, &value, value_len, &new_val_len TSRMLS_CC)) {
+ if (++count <= PG(max_input_vars) && sapi_module.input_filter(PARSE_POST, param, &value, value_len, &new_val_len TSRMLS_CC)) {
if (php_rfc1867_callback != NULL) {
multipart_event_formdata event_formdata;
size_t newlength = new_val_len;
@@ -879,15 +880,21 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
new_val_len = newlength;
}
safe_php_register_variable(param, value, new_val_len, array_ptr, 0 TSRMLS_CC);
- } else if (php_rfc1867_callback != NULL) {
- multipart_event_formdata event_formdata;
-
- event_formdata.post_bytes_processed = SG(read_post_bytes);
- event_formdata.name = param;
- event_formdata.value = &value;
- event_formdata.length = value_len;
- event_formdata.newlength = NULL;
- php_rfc1867_callback(MULTIPART_EVENT_FORMDATA, &event_formdata, &event_extra_data TSRMLS_CC);
+ } else {
+ if (count == PG(max_input_vars) + 1) {
+ 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));
+ }
+
+ if (php_rfc1867_callback != NULL) {
+ multipart_event_formdata event_formdata;
+
+ event_formdata.post_bytes_processed = SG(read_post_bytes);
+ event_formdata.name = param;
+ event_formdata.value = &value;
+ event_formdata.length = value_len;
+ event_formdata.newlength = NULL;
+ php_rfc1867_callback(MULTIPART_EVENT_FORMDATA, &event_formdata, &event_extra_data TSRMLS_CC);
+ }
}
if (!strcasecmp(param, "MAX_FILE_SIZE")) {