com php-src: fix possible out of bounds buffer access: Zend/zend_virtual_cwd.c
| From: | Anatol Belski | Date: | Mon, 03 Apr 2017 13:20:32 +0000 |
| Subject: | com php-src: fix possible out of bounds buffer access: Zend/zend_virtual_cwd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97471@lists.php.net to get a copy of this message | ||
Commit: feeb35e438db36f08bb82d493b11d4211201f23c
Author: Anatol Belski <ab@php.net> Mon, 3 Apr 2017 15:20:32 +0200
Parents: 670041b60ec25e822564d337bae96e82e8d9ac89
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=feeb35e438db36f08bb82d493b11d4211201f23c
Log:
fix possible out of bounds buffer access
Changed paths:
M Zend/zend_virtual_cwd.c
Diff:
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index ca19802..8009f2f 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 ||