Ticket #1527: heap corruption detected on large filenames

Fix bug, introduced in 27fbf91c28
commit. Really allocate 'dirent + NAME_MAX + 1', instead of
sizeof(void*) + NAME_MAX + 1.

Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
This commit is contained in:
Sergei Trofimovich 2009-08-12 12:37:32 +03:00
parent 3b37c6cd4e
commit 5f1ad860b7
1 changed files with 1 additions and 1 deletions

View File

@ -789,7 +789,7 @@ mc_readdir (DIR *dirp)
* structures, holding dirent size. But we don't use it in libc infrastructure.
* TODO: to make simpler homemade dirent-alike structure.
*/
mc_readdir_result = (struct dirent *)malloc(sizeof(struct dirent *) + NAME_MAX + 1);
mc_readdir_result = (struct dirent *)malloc(sizeof(struct dirent) + NAME_MAX + 1);
}
if (!dirp) {