2010.07.08 16:25 "[Tiff] strlcpy vs strncpy", by Bob Friesenhahn

2010.07.11 16:35 "Re: [Tiff] strlcpy vs strncpy", by Bob Friesenhahn

I tend to agree except for the fact that strlcpy() does absolutely assure null termination, even if the programmer made an error.

Uh oh. You have failed to consider the case of a zero-sized buffer. If your strlcpy overflows with a NUL byte, then it may corrupt a function pointer. If it doesn't, but you rely on getting a NUL byte, your app code may leak data by read-overflowing as the 0-byte "string" gets copied elsewhere.

Thanks for the review. While a size of zero is useless for GraphicsMagick's purposes, I will add support for it in the code in case it gets used by some other package.

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/