CVSROOT:        /cvs
Module name:    src
Changes by:     chel...@cvs.openbsd.org 2021/12/06 21:01:46

Modified files:
        lib/libc/stdlib: lsearch.c 

Log message:
lsearch(3): append key to array with memmove(3) instead of memcpy(3)

If the key overlaps the end of the array, memcpy(3) mutates the key
and copies a corrupted value into the end of the array.

If we use memmove(3) instead we at least end up with a clean copy of
the key at the end of the array.  This is closer to the intended
behavior.

With input from millert@ and deraadt@.

Thread: https://marc.info/?l=openbsd-tech&m=163880307403606&w=2

ok millert@

Reply via email to