diff options
author | Pierre Joye <pajoye@php.net> | 2011-09-26 08:49:28 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2011-09-26 08:49:28 +0000 |
commit | aeee365d72f9d14dec9430f6718e54d77c66c0a6 (patch) | |
tree | c0713dd2f5c3aa3f58ed28cf4e566f55fdc1c6c1 | |
parent | 3e0e2820b8d5b75214e4e854aa51aba1d47b109e (diff) | |
download | php-git-aeee365d72f9d14dec9430f6718e54d77c66c0a6.tar.gz |
- be sure to check if the var ha not been removed between the two calls
-rw-r--r-- | ext/standard/basic_functions.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index aecefa3d94..58e36c3cff 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4022,7 +4022,13 @@ PHP_FUNCTION(getenv) ptr = emalloc(size); size = GetEnvironmentVariableA(str, ptr, size); - RETURN_STRING(ptr, 0); + if (size == 0) { + /* has been removed between the two calls */ + efree(ptr); + RETURN_EMPTY_STRING(); + } else { + RETURN_STRING(ptr, 0); + } } #else /* system method returns a const */ |