#
61ed5748 |
| 19-Jul-2024 |
Robert Clausecker <fuz@FreeBSD.org> |
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 strlc
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
show more ...
|