1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 00:48:25 +02:00

MFH: revert patch that causes invalid reads/crashes on Linux

This commit is contained in:
Antony Dovgal
2008-05-12 08:47:29 +00:00
parent 1d30a554a4
commit 86cf005ca2
2 changed files with 7 additions and 3 deletions
-2
View File
@@ -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)
+7 -1
View File
@@ -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;
}
}