* Let fix_dirent() handle invalid reclen's gracefully.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32306 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-08-13 12:05:20 +00:00
parent 6dad3717d5
commit f9ba5c92e3

View File

@ -5563,6 +5563,10 @@ fix_dirent(struct vnode* parent, struct dirent* userEntry,
ASSERT(entry->d_reclen >= sizeof(struct dirent)); ASSERT(entry->d_reclen >= sizeof(struct dirent));
// This hints to a problem in the file system implementation
if (entry->d_reclen < sizeof(struct dirent))
return B_BAD_DATA;
if (user_memcpy(entry->d_name, userEntry->d_name, if (user_memcpy(entry->d_name, userEntry->d_name,
entry->d_reclen + 1 - sizeof(struct dirent)) != B_OK) entry->d_reclen + 1 - sizeof(struct dirent)) != B_OK)
return B_BAD_ADDRESS; return B_BAD_ADDRESS;