diff -uPr php-4.0.4.orig/ext/standard/exec.c php-4.0.4/ext/standard/exec.c --- php-4.0.4.orig/ext/standard/exec.c Wed Dec 13 23:42:12 2000 +++ php-4.0.4/ext/standard/exec.c Fri Jan 5 11:58:29 2001 @@ -62,11 +62,7 @@ overflow_limit = l; c = strchr(cmd, ' '); if (c) *c = '\0'; - if (strstr(cmd, "..")) { - php_error(E_WARNING, "No '..' components allowed in path"); - efree(buf); - return -1; - } + d = emalloc(l); strcpy(d, PG(safe_mode_exec_dir)); overflow_limit -= ldir; @@ -86,6 +82,11 @@ tmp = php_escape_shell_cmd(d); efree(d); d = tmp; + if (strstr(d, "..")) { + php_error(E_WARNING, "No '..' components allowed in path"); + efree(d); + return -1; + } #ifdef PHP_WIN32 fp = V_POPEN(d, "rb"); #else