summaryrefslogtreecommitdiff
path: root/main/php_ini.c
diff options
context:
space:
mode:
authorHannes Magnusson <bjori@php.net>2007-05-12 16:06:46 +0000
committerHannes Magnusson <bjori@php.net>2007-05-12 16:06:46 +0000
commit909894682d2b47700cd20f0e7f4d343276757a3e (patch)
tree0ada1864e60465be8f74d409aafd4a19fee92292 /main/php_ini.c
parentc5c162d1824891716349aeabef49c9209ac509fe (diff)
downloadphp-git-909894682d2b47700cd20f0e7f4d343276757a3e.tar.gz
MFH: bug#41361 (shell_exec() does not find binaries)
Diffstat (limited to 'main/php_ini.c')
-rw-r--r--main/php_ini.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main/php_ini.c b/main/php_ini.c
index aa9a96ceeb..b92a83b193 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -354,12 +354,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) {