HomeFreeBSD

lib/libc/tests/string: improve memccpy "bounds" unit test

Description

lib/libc/tests/string: improve memccpy "bounds" unit test

The purpose of the "bounds" test is to check that the function does not
overread the array bounds. The old unit test, copied from the strlcpy()
one, always ensured that we see the character c memccpy() is looking for
in the source array before the array ends. While this is correct for
strlcpy(), memccpy()'s specification does not guarantee that c is
present within the given size limit.

The updated test handles this case better, ensuring that the source
array ends early if c is not supposed to be present.

Reported by: getz
Approved by: emaste
See also: D46052
Event: GSoC 2024
Differential Revision: https://reviews.freebsd.org/D46051

Details

Provenance
fuzAuthored on Jul 19 2024, 8:50 PM
Differential Revision
D46051: lib/libc/tests/string: improve memccpy "bounds" unit test
Parents
rGecb75be376a3: libpcap: Add changes missed in update to 1.10.5
Branches
Unknown
Tags
Unknown