locale: use memmove for potentially overlapping data

DJ Delorie dj@redhat.com
Thu Nov 7 18:27:27 GMT 2024


Paul Eggert <eggert@cs.ucla.edu> writes:
> sizeof ctx->buffer is 128, so locale/programs/md5.c line 167:
>
>    memcpy (&ctx->buffer[left_over], buffer, len);
>
> means left_over + len <= 128 (otherwise behavior would be undefined). 

Can this be proven, other than through a lack of segfaults?  The whole
point of this is to prove that undefined behavior can't happen, not rely
on it.



More information about the Libc-alpha mailing list