about summary refs log tree commit diff
path: root/sysdeps/unix/readdir_r.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2010-12-19 16:00:59 -0500
committerUlrich Drepper <drepper@gmail.com>2010-12-19 16:00:59 -0500
commitdb753e2cfb2051ebf20dc089f87c5b1297cc2cff (patch)
tree5d68eb522e716f4a0ed441e60bb6259bafc40418 /sysdeps/unix/readdir_r.c
parent283007197c526f8f59bdc029a38d76538c70b0ff (diff)
downloadglibc-db753e2cfb2051ebf20dc089f87c5b1297cc2cff.tar.gz
glibc-db753e2cfb2051ebf20dc089f87c5b1297cc2cff.tar.xz
glibc-db753e2cfb2051ebf20dc089f87c5b1297cc2cff.zip
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.
Diffstat (limited to 'sysdeps/unix/readdir_r.c')
-rw-r--r--sysdeps/unix/readdir_r.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sysdeps/unix/readdir_r.c b/sysdeps/unix/readdir_r.c
index 93727912c1..e166174883 100644
--- a/sysdeps/unix/readdir_r.c
+++ b/sysdeps/unix/readdir_r.c
@@ -117,7 +117,8 @@ __READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
 #ifdef GETDENTS_64BIT_ALIGNED
       /* The d_reclen value might include padding which is not part of
 	 the DIRENT_TYPE data structure.  */
-      reclen = MIN (reclen, sizeof (DIRENT_TYPE));
+      reclen = MIN (reclen,
+		    offsetof (DIRENT_TYPE, d_name) + sizeof (dp->d_name));
 #endif
       *result = memcpy (entry, dp, reclen);
 #ifdef GETDENTS_64BIT_ALIGNED