diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/compat/dirent_msvc.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/compat/dirent_msvc.h b/include/compat/dirent_msvc.h index 67f295f..e8a0956 100644 --- a/include/compat/dirent_msvc.h +++ b/include/compat/dirent_msvc.h | |||
| @@ -165,7 +165,8 @@ _wopendir(const wchar_t *dirname) | |||
| 165 | n = GetFullPathNameW(dirname, 0, NULL, NULL); | 165 | n = GetFullPathNameW(dirname, 0, NULL, NULL); |
| 166 | 166 | ||
| 167 | /* Allocate room for absolute directory name and search pattern */ | 167 | /* Allocate room for absolute directory name and search pattern */ |
| 168 | dirp->patt =(wchar_t*) malloc(sizeof(wchar_t) * n + 16); | 168 | if (n <= (SIZE_MAX - 16) / sizeof(wchar_t)) |
| 169 | dirp->patt =(wchar_t*) malloc(sizeof(wchar_t) * n + 16); | ||
| 169 | if (dirp->patt) { | 170 | if (dirp->patt) { |
| 170 | 171 | ||
| 171 | /* | 172 | /* |
