strlcpy
Posted Jun 12, 2003 7:46 UTC (Thu) by
set (guest, #4788)
In reply to:
strlcpy by JoeBuck
Parent article:
strlcpy
Linus claims to have maintained *BSD compatibility, though he
wrote the functions himself:
"Ok, I did my own versions, since (a) I had already started and your
patches wouldn't apply, and (b) I hate adding a zillion lines of extra
copyright notices for a 5-line function..."
(strlcat was added as well)
I dont think strcpy is the main target, as much as strncpy. Linus again:
"Yeah, "strncpy()" is a frigging disaster when it comes to '\0', in many
ways. We should probably disallow using strncpy(), and aim for a _sane_
implementation that does what we actually want (none of that zero-padding
crap, and _always_ put a NUL at the end). I bet that is what most current
strncpy() users actually would want."
A light grep of 2.5.70 shows many uses of strlcpy, strncpy, and strcpy
out there...
Paul
(
Log in to post comments)