]> granicus.if.org Git - musl/commit
fix regression in alignment of dirent structs produced by readdir
authorRich Felker <dalias@aerifal.cx>
Wed, 18 Jul 2018 17:25:48 +0000 (13:25 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 18 Jul 2018 17:34:34 +0000 (13:34 -0400)
commitb3fa0f2b1b8c267c1cbe8c62464e484f3a174a4e
tree7d5c1d52617b69d62ddf4fbba48c2aaabeb8290a
parentdf6d9450ea19fd71e52cf5cdb4c85beb73066394
fix regression in alignment of dirent structs produced by readdir

commit 32482f61da7650ff10741bd5aedd66bbc3ea165b reduced the number of
int members before the dirent buf from 4 to 3, thereby misaligning it
mod sizeof(off_t), producing invalid accesses on any arch where
alignof(off_t)==sizeof(off_t).

rather than re-adding wasted padding, reorder the struct to meet the
requirement and add a comment and static assertion to prevent this
from getting broken again.
src/dirent/__dirent.h
src/dirent/readdir.c