From e7c7f95ecd7beef2e038b3c55e008d02c1aec46c Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Sat, 12 May 2007 16:06:07 +0000 Subject: [PATCH] Fixed bug#41361 (shell_exec() does not find binaries) --- main/php_ini.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main/php_ini.c b/main/php_ini.c index 8a7b5594ac..3b8e58d8c6 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -352,12 +352,15 @@ int php_init_config(TSRMLS_D) if (sapi_module.executable_location) { binary_location = (char *)emalloc(PATH_MAX); if (!strchr(sapi_module.executable_location, '/')) { - char *path; + char *envpath, *path; int found = 0; - if ((path = getenv("PATH")) != NULL) { + if ((envpath = getenv("PATH")) != NULL) { char *search_dir, search_path[MAXPATHLEN]; char *last; + int pathlen = strlen(envpath) + 1; + path = malloc(pathlen); + memcpy(path, envpath, pathlen); search_dir = php_strtok_r(path, ":", &last); while (search_dir) { -- 2.50.1