Skip to content

Commit

Permalink
fix #40586 (_ENV vars get escaped when magic_quotes_gpc is on)
Browse files Browse the repository at this point in the history
  • Loading branch information
tony2001 committed Mar 26, 2007
1 parent afcea49 commit 2b4ec78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions main/php_variables.c
Expand Up @@ -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, '=');
Expand All @@ -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;
}


Expand Down

0 comments on commit 2b4ec78

Please sign in to comment.