From: Anatol Belski Date: Sat, 13 Jun 2015 16:44:56 +0000 (+0200) Subject: Fix bug #69814 Enabling php_curl, php_mysqli, and php_openssl causes php-cgi to crash X-Git-Tag: php-7.0.0alpha2~2^2~151 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6084844fb5b93d3712d5b1376ed99bfa6c51b637;p=php Fix bug #69814 Enabling php_curl, php_mysqli, and php_openssl causes php-cgi to crash --- diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 330fff187d..cc3fff4416 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -553,6 +553,11 @@ CWD_API char *virtual_getcwd_ex(size_t *length) /* {{{ */ return retval; } #endif + if (!state->cwd) { + *length = 0; + return NULL; + } + *length = state->cwd_length; return estrdup(state->cwd); } @@ -574,6 +579,9 @@ CWD_API char *virtual_getcwd(char *buf, size_t size) /* {{{ */ errno = ERANGE; /* Is this OK? */ return NULL; } + if (!cwd) { + return NULL; + } memcpy(buf, cwd, length+1); efree(cwd); return buf;