Browse Source
Merge branch 'PHP-7.2'
* PHP-7.2:
Check for binary_location allocation failure
pull/2894/merge
krakjoe
9 years ago
No known key found for this signature in database
GPG Key ID: F9BA0ADA31CBD89E
1 changed files with
3 additions and
5 deletions
-
main/main.c
|
|
|
@ -271,17 +271,17 @@ static void php_disable_classes(void) |
|
|
|
*/ |
|
|
|
static void php_binary_init(void) |
|
|
|
{ |
|
|
|
char *binary_location; |
|
|
|
char *binary_location = NULL; |
|
|
|
#ifdef PHP_WIN32 |
|
|
|
binary_location = (char *)malloc(MAXPATHLEN); |
|
|
|
if (GetModuleFileName(0, binary_location, MAXPATHLEN) == 0) { |
|
|
|
if (binary_location && GetModuleFileName(0, binary_location, MAXPATHLEN) == 0) { |
|
|
|
free(binary_location); |
|
|
|
PG(php_binary) = NULL; |
|
|
|
} |
|
|
|
#else |
|
|
|
if (sapi_module.executable_location) { |
|
|
|
binary_location = (char *)malloc(MAXPATHLEN); |
|
|
|
if (!strchr(sapi_module.executable_location, '/')) { |
|
|
|
if (binary_location && !strchr(sapi_module.executable_location, '/')) { |
|
|
|
char *envpath, *path; |
|
|
|
int found = 0; |
|
|
|
|
|
|
|
@ -311,8 +311,6 @@ static void php_binary_init(void) |
|
|
|
free(binary_location); |
|
|
|
binary_location = NULL; |
|
|
|
} |
|
|
|
} else { |
|
|
|
binary_location = NULL; |
|
|
|
} |
|
|
|
#endif |
|
|
|
PG(php_binary) = binary_location; |
|
|
|
|