summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2008-05-12 08:47:29 +0000
committerAntony Dovgal <tony2001@php.net>2008-05-12 08:47:29 +0000
commit86cf005ca2619171c7832ff65e1cd703d2ea79c5 (patch)
treeb6f1e3ad842598aea65ffa2bd0a6c9dfb024a90b
parent1d30a554a48c44998fd44831b23170b27f1fa202 (diff)
downloadphp-git-86cf005ca2619171c7832ff65e1cd703d2ea79c5.tar.gz
MFH: revert patch that causes invalid reads/crashes on Linux
-rw-r--r--NEWS2
-rw-r--r--ext/standard/basic_functions.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 791ae06594..d665e31c29 100644
--- a/NEWS
+++ b/NEWS
@@ -5,8 +5,6 @@ PHP NEWS
functions. (Andrey)
- Fixed bug #44891 Memory leak using registerPHPFunctions and XSLT Variable
as function parameter. (Rob)
-- Fixed bug #44836 (putenv() crashes, avoid direct reference of environ in
- POSIX systems). (Ilia, delphij at FreeBSD dot org)
- Fixed bug #44830 (Very minor issue with backslash in heredoc). (Matt)
- Fixed bug #44811 (Improve error message when creating a new SoapClient that
contains invalid data). (Markus Fischer, David C)
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 330f717c69..cec0b1f636 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -3859,7 +3859,9 @@ static void php_putenv_destructor(putenv_entry *pe)
SetEnvironmentVariable(pe->key, "bugbug");
#endif
putenv(pe->previous_value);
+# if defined(PHP_WIN32)
efree(pe->previous_value);
+# endif
} else {
# if HAVE_UNSETENV
unsetenv(pe->key);
@@ -4459,8 +4461,12 @@ PHP_FUNCTION(putenv)
pe.previous_value = NULL;
for (env = environ; env != NULL && *env != NULL; env++) {
if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
- /* must copy previous value because putenv can free the string without notice */
+#if defined(PHP_WIN32)
+ /* must copy previous value because MSVCRT's putenv can free the string without notice */
pe.previous_value = estrdup(*env);
+#else
+ pe.previous_value = *env;
+#endif
break;
}
}