|
|
Log in / Subscribe / Register

memccpy()

memccpy()

Posted Aug 26, 2022 9:11 UTC (Fri) by joib (subscriber, #8541)
Parent article: Ushering out strlcpy()

No love for memccpy() in the kernel (note, two 'c's, this is not memcpy())?

This has apparently been in POSIX forever, and is also supposedly going to be part of C2X.

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2349.htm


to post comments

memccpy()

Posted Aug 26, 2022 10:43 UTC (Fri) by bluss (guest, #47454) [Link]

And the nice documentation here says "To avoid the risk of buffer overflow" and produces an example that uses the returned pointer p without checking if p was NULL, which is may reasonably be. :)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds