pajoye Mon, 26 Sep 2011 08:49:28 +
Revision: http://svn.php.net/viewvc?view=revision&revision=317306
Log:
- be sure to check if the var ha not been removed between the two calls
Changed paths:
U php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U php/php-src/branches/PHP_5_4/main/php_ini.c
U php/php-src/trunk/ext/standard/basic_functions.c
Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-09-26
08:38:03 UTC (rev 317305)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-09-26
08:49:28 UTC (rev 317306)
@@ -4022,7 +4022,13 @@
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 */
Modified: php/php-src/branches/PHP_5_4/main/php_ini.c
===
--- php/php-src/branches/PHP_5_4/main/php_ini.c 2011-09-26 08:38:03 UTC (rev
317305)
+++ php/php-src/branches/PHP_5_4/main/php_ini.c 2011-09-26 08:49:28 UTC (rev
317306)
@@ -421,7 +421,11 @@
env_location = "";
} else {
size = GetEnvironmentVariableA("PHPRC",
phprc_path, size);
- env_location = phprc_path;
+ if (size == 0) {
+ env_location = "";
+ } else {
+ env_location = phprc_path;
+ }
}
}
}
Modified: php/php-src/trunk/ext/standard/basic_functions.c
===
--- php/php-src/trunk/ext/standard/basic_functions.c2011-09-26 08:38:03 UTC
(rev 317305)
+++ php/php-src/trunk/ext/standard/basic_functions.c2011-09-26 08:49:28 UTC
(rev 317306)
@@ -4024,7 +4024,13 @@
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 */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php