* Also have the uppper limit check in the assert.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32323 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-08-13 16:49:53 +00:00
parent 7712cf43c3
commit 368fc35adf
1 changed files with 4 additions and 2 deletions

View File

@ -5561,9 +5561,11 @@ fix_dirent(struct vnode* parent, struct dirent* userEntry,
if (user_memcpy(entry, userEntry, sizeof(struct dirent) - 1) != B_OK)
return B_BAD_ADDRESS;
ASSERT(entry->d_reclen >= sizeof(struct dirent));
ASSERT(entry->d_reclen >= sizeof(struct dirent)
&& entry->d_reclen <= sizeof(buffer));
// This hints to a problem in the file system implementation
// This hints to a problem in the file system implementation, but
// could also be caused by a malicious user application
if (entry->d_reclen < sizeof(struct dirent)
|| entry->d_reclen > sizeof(buffer))
return B_BAD_DATA;