History log of /freebsd-src/lib/libc/tests/string/memccpy_test.c (Results 1 – 2 of 2)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/14.2.0, release/13.4.0
# 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 ...


Revision tags: release/14.1.0, release/13.3.0
# e4b7b0bc 03-Dec-2023 Robert Clausecker <fuz@FreeBSD.org>

lib/libc/tests/string: add unit tests for memccpy()

Adapted from the strlcpy() unit tests.

Tested by: developers@, exp-run
Approved by: mjg
MFC after: 1 month
MFC to: stable/14
PR: 275785