summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-04-03 15:20:32 +0200
committerAnatol Belski <ab@php.net>2017-04-03 15:20:32 +0200
commitfeeb35e438db36f08bb82d493b11d4211201f23c (patch)
treeca1305c12a4f3e80b2e4189090b1ffa583fe770b
parent670041b60ec25e822564d337bae96e82e8d9ac89 (diff)
downloadphp-git-feeb35e438db36f08bb82d493b11d4211201f23c.tar.gz
fix possible out of bounds buffer access
-rw-r--r--Zend/zend_virtual_cwd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index ca19802ff7..8009f2f3fd 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -380,7 +380,7 @@ CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat) /* {{
if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
size_t len = strlen(path);
- if (path[len-4] == '.') {
+ if (len >= 4 && path[len-4] == '.') {
if (_memicmp(path+len-3, "exe", 3) == 0 ||
_memicmp(path+len-3, "com", 3) == 0 ||
_memicmp(path+len-3, "bat", 3) == 0 ||