]> granicus.if.org Git - php/commitdiff
- Fixed a possible stack exaustion inside fnmatch(). Reporeted by Stefan Esser
authorIlia Alshanetsky <iliaa@php.net>
Sun, 2 May 2010 19:34:21 +0000 (19:34 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 2 May 2010 19:34:21 +0000 (19:34 +0000)
ext/standard/file.c

index 71542ba7b850716f69c98d755a1202a25ec93747..420c7b807361bcd9911090209085619efe49c94c 100644 (file)
@@ -2469,6 +2469,10 @@ PHP_FUNCTION(fnmatch)
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filename exceeds the maximum allowed length of %d characters", MAXPATHLEN);
                RETURN_FALSE;
        }
+       if (pattern_len >= MAXPATHLEN) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pattern exceeds the maximum allowed length of %d characters", MAXPATHLEN);
+               RETURN_FALSE;
+       }
 
        RETURN_BOOL( ! fnmatch( pattern, filename, flags ));
 }