summaryrefslogtreecommitdiffstats
path: root/winsup/mingw/mingwex/dirent.c
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mingwex/dirent.c')
-rw-r--r--winsup/mingw/mingwex/dirent.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/winsup/mingw/mingwex/dirent.c b/winsup/mingw/mingwex/dirent.c
index 20d1921d7..e3c81e1b2 100644
--- a/winsup/mingw/mingwex/dirent.c
+++ b/winsup/mingw/mingwex/dirent.c
@@ -76,8 +76,8 @@ _topendir (const _TCHAR *szPath)
/* Allocate enough space to store DIR structure and the complete
* directory path given. */
- nd = (_TDIR *) malloc (sizeof (_TDIR) + _tcslen (szFullPath) + _tcslen (SLASH) +
- _tcslen (SUFFIX));
+ nd = (_TDIR *) malloc (sizeof (_TDIR) + (_tcslen(szFullPath) + _tcslen (SLASH) +
+ _tcslen(SUFFIX) + 1) * sizeof(_TCHAR));
if (!nd)
{