[PATCH 1/6] dirent: Restore padding in tst-getdents64

DJ Delorie dj@redhat.com
Fri Sep 25 16:28:03 GMT 2026


On Thu, Sep 24, 2026 at 10:37 AM Muhammad Kamran
<muhammad.kamran@arm.com> wrote:
> That memcpy can read past the heap allocation when the current
> record is near the end of the buffer.  Allocate the same extra
> padding on the heap, while still passing only buffer_size to
> getdents64.

I think this is acceptable, but to me it would make more sense to
check d_reclen earlier, then use that in the memcpy.  We rely on
d_reclen to bump the current pointer anyway, but should verify we're
not getting records larger than our anticipated struct size.

We could also change the test to point to the structure inside the
buffer, rather than memcpy the data out.

I'm OK with just putting it back to "the way it was", though.

Reviewed-by: DJ Delorie <dj@redhat.com>



More information about the Libc-alpha mailing list