Ushering out strlcpy()
Ushering out strlcpy()
Posted Aug 30, 2022 7:10 UTC (Tue) by milesrout (subscriber, #126894)In reply to: Ushering out strlcpy() by wtarreau
Parent article: Ushering out strlcpy()
>Agreed, I too would like to see strncpy() disappear, as it tends to lie to the reader. I've seen it be entirely responsible for major slowdowns a few times in different projects by the way, where users did not realize that it was padding the whole target buffer.
These people should not be programming in C.
"If the length of src is less than n, strncpy() writes additional null bytes to dest to ensure that a total of n bytes are written."
Right there in the man page. If you can't read the most basic documentation, don't use the language!
