]> granicus.if.org Git - php/commitdiff
MFH: crash fix in glob() with no results
authorMelvyn Sopacua <msopacua@php.net>
Tue, 24 Dec 2002 15:04:10 +0000 (15:04 +0000)
committerMelvyn Sopacua <msopacua@php.net>
Tue, 24 Dec 2002 15:04:10 +0000 (15:04 +0000)
ext/standard/dir.c

index d0e8c042b5dd3c3eddc48e2e8e248e4504e98cbb..1a7aa81e5d5840518986821cb949730b0a80fbfb 100644 (file)
@@ -400,6 +400,9 @@ PHP_FUNCTION(glob)
 
        /* we assume that any glob pattern will match files from one directory only
           so checking the dirname of the first match should be sufficient */
+       if (!globbuf.gl_pathv) {
+               RETURN_FALSE;
+       }
        strncpy(cwd, globbuf.gl_pathv[0], MAXPATHLEN);
        if (PG(safe_mode) && (!php_checkuid(cwd, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
                RETURN_FALSE;