strlcpy
Posted Jun 14, 2003 1:12 UTC (Sat) by
giraffedata (subscriber, #1954)
In reply to:
strlcpy by ncm
Parent article:
strlcpy
All the criticisms of strlcpy based on the idea that it's always wrong to copy just part of a string ignore the fact that there are millions of places in code where it's no big deal to copy just part of the string occasionally, and those are the places where the programmer doesn't want to waste precious time dealing with the possibility that his buffer is too small.
For example, I'm going to write the message on the screen for a human user to read. So what if the message is truncated to 1000 characters? Let me just strlcpy it and be done with it.
(
Log in to post comments)