mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 10:50:07 +00:00
More accurate computatin of reclen in readdir_r.
Alignment issue can increase the reclen limit. Make sure Linux 64-bit readdir_r also accounts for 64-bit alignment in getdents.
This commit is contained in:
parent
283007197c
commit
db753e2cfb
@ -1,3 +1,9 @@
|
|||||||
|
2010-12-19 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/readdir_r.c (__READDIR_R): Compute reclen more accurate.
|
||||||
|
* sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c: Define
|
||||||
|
GETDENTS_64BIT_ALIGNED.
|
||||||
|
|
||||||
2010-12-14 Ulrich Drepper <dreper@gmail.com>
|
2010-12-14 Ulrich Drepper <dreper@gmail.com>
|
||||||
|
|
||||||
* sysdeps/i386/i686/multiarch/strcmp.S: Undo accident checkin.
|
* sysdeps/i386/i686/multiarch/strcmp.S: Undo accident checkin.
|
||||||
|
@ -117,7 +117,8 @@ __READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
|
|||||||
#ifdef GETDENTS_64BIT_ALIGNED
|
#ifdef GETDENTS_64BIT_ALIGNED
|
||||||
/* The d_reclen value might include padding which is not part of
|
/* The d_reclen value might include padding which is not part of
|
||||||
the DIRENT_TYPE data structure. */
|
the DIRENT_TYPE data structure. */
|
||||||
reclen = MIN (reclen, sizeof (DIRENT_TYPE));
|
reclen = MIN (reclen,
|
||||||
|
offsetof (DIRENT_TYPE, d_name) + sizeof (dp->d_name));
|
||||||
#endif
|
#endif
|
||||||
*result = memcpy (entry, dp, reclen);
|
*result = memcpy (entry, dp, reclen);
|
||||||
#ifdef GETDENTS_64BIT_ALIGNED
|
#ifdef GETDENTS_64BIT_ALIGNED
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#define readdir64_r __no_readdir64_r_decl
|
#define readdir64_r __no_readdir64_r_decl
|
||||||
|
#define GETDENTS_64BIT_ALIGNED 1
|
||||||
#include <sysdeps/unix/readdir_r.c>
|
#include <sysdeps/unix/readdir_r.c>
|
||||||
#undef readdir64_r
|
#undef readdir64_r
|
||||||
weak_alias (__readdir_r, readdir64_r)
|
weak_alias (__readdir_r, readdir64_r)
|
||||||
|
Loading…
Reference in New Issue
Block a user