Skip to content

Commit 409f64d

Browse files
author
Melvyn Sopacua
committed
MFH: crash fix in glob() with no results
1 parent 5367710 commit 409f64d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ext/standard/dir.c

+3
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,9 @@ PHP_FUNCTION(glob)
400400

401401
/* we assume that any glob pattern will match files from one directory only
402402
so checking the dirname of the first match should be sufficient */
403+
if (!globbuf.gl_pathv) {
404+
RETURN_FALSE;
405+
}
403406
strncpy(cwd, globbuf.gl_pathv[0], MAXPATHLEN);
404407
if (PG(safe_mode) && (!php_checkuid(cwd, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
405408
RETURN_FALSE;

0 commit comments

Comments
 (0)