fix possible out of bounds buffer access

This commit is contained in:
Anatol Belski 2017-04-03 15:20:32 +02:00
parent 670041b60e
commit feeb35e438

View file

@ -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) { if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
size_t len = strlen(path); size_t len = strlen(path);
if (path[len-4] == '.') { if (len >= 4 && path[len-4] == '.') {
if (_memicmp(path+len-3, "exe", 3) == 0 || if (_memicmp(path+len-3, "exe", 3) == 0 ||
_memicmp(path+len-3, "com", 3) == 0 || _memicmp(path+len-3, "com", 3) == 0 ||
_memicmp(path+len-3, "bat", 3) == 0 || _memicmp(path+len-3, "bat", 3) == 0 ||