summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-03-26 10:33:03 +0000
committerAntony Dovgal <tony2001@php.net>2007-03-26 10:33:03 +0000
commit2b4ec789be9cab5d44c364d64277a7b3c91337e7 (patch)
tree7956634bcb98c02b5b5c4c57b432c737e04a6997
parentafcea496f3adac0da85984b1ec9c6c57d6f0f436 (diff)
downloadphp-git-2b4ec789be9cab5d44c364d64277a7b3c91337e7.tar.gz
fix #40586 (_ENV vars get escaped when magic_quotes_gpc is on)
-rw-r--r--NEWS1
-rw-r--r--main/php_variables.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 3f01aedff1..dd7eeff11a 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ PHP 4 NEWS
handle). (Tony)
- Fixed bug #40747 (possible crash in session when save_path is out of
open_basedir). (Tony)
+- Fixed bug #40586 (_ENV vars get escaped when magic_quotes_gpc is on). (Tony)
- Fixed MOPB-8, XSS in phpinfo() (Joe Orton, Stas)
- Fixed unallocated memory access/double free in in array_user_key_compare()
(MOPB-24 by Stefan Esser) (Stas)
diff --git a/main/php_variables.c b/main/php_variables.c
index 92ac036a1b..aec0869643 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -351,6 +351,8 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
{
char **env, *p, *t;
+ int magic_quotes_gpc = PG(magic_quotes_gpc);
+ PG(magic_quotes_gpc) = 0;
for (env = environ; env != NULL && *env != NULL; env++) {
p = strchr(*env, '=');
@@ -361,6 +363,7 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
php_register_variable(t, p+1, array_ptr TSRMLS_CC);
efree(t);
}
+ PG(magic_quotes_gpc) = magic_quotes_gpc;
}