]> granicus.if.org Git - php/commitdiff
Fix bug #69814 Enabling php_curl, php_mysqli, and php_openssl causes php-cgi to crash
authorAnatol Belski <ab@php.net>
Sat, 13 Jun 2015 16:44:56 +0000 (18:44 +0200)
committerAnatol Belski <ab@php.net>
Sat, 13 Jun 2015 16:45:27 +0000 (18:45 +0200)
Zend/zend_virtual_cwd.c

index 330fff187d5ba7bf43aaee3e8c28dfff54dd4187..cc3fff44162950a3a09540e7626c3b6390e485e3 100644 (file)
@@ -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;