Page MenuHomeFreeBSD

libc/tests/string: improve stpncpy() "bounds" unit test
ClosedPublic

Authored by fuz on Dec 10 2025, 9:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jan 18, 3:19 AM
Unknown Object (File)
Sat, Jan 10, 4:45 PM
Unknown Object (File)
Sat, Jan 10, 5:31 AM
Unknown Object (File)
Wed, Dec 31, 2:05 PM
Unknown Object (File)
Wed, Dec 31, 12:17 AM
Unknown Object (File)
Sun, Dec 28, 11:06 PM
Unknown Object (File)
Fri, Dec 26, 5:38 AM
Unknown Object (File)
Mon, Dec 22, 4:17 PM
Subscribers

Details

Summary

The test is extended the same way I previously extended the memccpy()
test to fix what is probably the same kind of bug.

PR: 291359
Reported by: Collin Funk <collin.funk1@gmail.com>
Fixes: 6fa9e7d8737548ef93c573387ce62402c368d486 (D42519)
See also: 61ed5748e4e9c7397fcb2638b442f46ac5c9e7c5 (D46051)
MFC after: 1 week

Test Plan

now correctly diagnoses bug #291359, while other
implementations of stpncpy() still pass.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

fuz requested review of this revision.Dec 10 2025, 9:18 PM
ngie added inline comments.
lib/libc/tests/string/stpncpy_test.c
105
This revision is now accepted and ready to land.Dec 11 2025, 6:58 AM