summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2012-03-20 10:21:07 +0100
committerOndřej Surý <ondrej@sury.org>2012-03-21 08:44:59 +0100
commitd1fd5432e1576865dbeb7650b7c7e0fa0bd3a4e1 (patch)
treed29b55e2c069317c5b12c669a5678448e6be9245 /main
parent4a6d9b348febe7895a2748977898c09b6e40a7ce (diff)
downloadphp-git-d1fd5432e1576865dbeb7650b7c7e0fa0bd3a4e1.tar.gz
Fixed bug #61043 (Regression in magic_quotes_gpc fix for CVE-2012-0831)
Diffstat (limited to 'main')
-rw-r--r--main/php_variables.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/main/php_variables.c b/main/php_variables.c
index 29d4e4e9e2..4b97cbd85f 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -450,7 +450,7 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
/* turn off magic_quotes while importing environment variables */
int magic_quotes_gpc = PG(magic_quotes_gpc);
- if (PG(magic_quotes_gpc)) {
+ if (magic_quotes_gpc) {
zend_alter_ini_entry_ex("magic_quotes_gpc", sizeof("magic_quotes_gpc"), "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE, 1 TSRMLS_CC);
}
@@ -471,7 +471,10 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
if (t != buf && t != NULL) {
efree(t);
}
- PG(magic_quotes_gpc) = magic_quotes_gpc;
+
+ if (magic_quotes_gpc) {
+ zend_alter_ini_entry_ex("magic_quotes_gpc", sizeof("magic_quotes_gpc"), "1", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE, 1 TSRMLS_CC);
+ }
}
zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC)
@@ -595,7 +598,7 @@ static inline void php_register_server_variables(TSRMLS_D)
zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
}
PG(http_globals)[TRACK_VARS_SERVER] = array_ptr;
- if (PG(magic_quotes_gpc)) {
+ if (magic_quotes_gpc) {
zend_alter_ini_entry_ex("magic_quotes_gpc", sizeof("magic_quotes_gpc"), "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE, 1 TSRMLS_CC);
}
@@ -622,7 +625,9 @@ static inline void php_register_server_variables(TSRMLS_D)
php_register_variable_ex("REQUEST_TIME", &new_entry, array_ptr TSRMLS_CC);
}
- PG(magic_quotes_gpc) = magic_quotes_gpc;
+ if (magic_quotes_gpc) {
+ zend_alter_ini_entry_ex("magic_quotes_gpc", sizeof("magic_quotes_gpc"), "1", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_ACTIVATE, 1 TSRMLS_CC);
+ }
}
/* }}} */