| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2010.07.11 16:35 "Re: strlcpy vs strncpy", by Bob FriesenhahnOn Sun, 11 Jul 2010, Albert Cahalan wrote: >> >> 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/ |
|||||||