This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/11333] size of struct dirent does not agree with kernel when using LFS on 32bit
- From: "kees at outflux dot net" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 27 Feb 2010 06:38:31 -0000
- Subject: [Bug libc/11333] size of struct dirent does not agree with kernel when using LFS on 32bit
- References: <20100227055549.11333.kees@outflux.net>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From kees at outflux dot net 2010-02-27 06:38 -------
Created an attachment (id=4638)
--> (http://sourceware.org/bugzilla/attachment.cgi?id=4638&action=view)
test.c
This reports the reclen coming from the dirp->data. sysdeps/unix/readdir_r.c:
bytes = __GETDENTS (dirp->fd, dirp->data, maxread);
...
dp = (DIRENT_TYPE *) &dirp->data[dirp->offset];
...
reclen = dp->d_reclen;
...
*result = memcpy (entry, dp, reclen);
It seems that the memcpy is what overflows. I wonder if adding an
"assert(sizeof(*entry) >= reclen)" should be added in here for fun, too.
--
What |Removed |Added
----------------------------------------------------------------------------
Attachment #4637 is|0 |1
obsolete| |
http://sourceware.org/bugzilla/show_bug.cgi?id=11333
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.