LWN.net Logo

strlcpy

strlcpy

Posted Jun 12, 2003 7:12 UTC (Thu) by bgilbert (subscriber, #4738)
In reply to: strlcpy by ncm
Parent article: strlcpy

> Second, if told it has a zero-length buffer, it doesn't even
> null-terminate it, leaving whatever was already present in the
> buffer in place.

If told it has a zero-length buffer, where is it supposed to put the null? Yes, the zero length probably indicates a bug of some sort, but you seem to be proposing that the function should deliberately write past the end of the buffer in this case. That seems rather counterproductive.


(Log in to post comments)

strlcpy

Posted Jun 13, 2003 0:14 UTC (Fri) by ncm (subscriber, #165) [Link]

"you seem to be proposing that the function should deliberately write past the end of the buffer in this case"

I see that you stopped reading at that point. Pray read on. Programming errors shouldn't silently be worked around, they should result in a lot of noise, smoke, and flame.

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