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

2010.07.12 17:34 "Re: [Tiff] strlcpy vs strncpy", by Dmitry V. Levin

On Thu, Jul 08, 2010 at 11:25:26AM -0500, Bob Friesenhahn wrote:

GraphicsMagick is using strlcpy() and strlcat() for secure string copies. I will be happy to contribute versions that I wrote myself for use in libtiff if libtiff choses to rely on these more secure functions. Libtiff should name the replacement functions differently in order to avoid any possible conflict/confusion with system provided versions, or versions from some dependent library or program.

If these functions are going to be added to libtiff, please do not change their names. Instead, add an autoconf test and a couple of ifdefs so that on systems where strlcpy() and strlcat() are provided by libc no redundant implementations are added. Something like this:

AC_CHECK_FUNCS(strlcat strlcpy)

# define strlcpy tiff_strlcpy
[a declaration of strlcpy()]
#endif /* HAVE_STRLCPY */

[an implementation of strlcpy()]
#endif /* HAVE_STRLCPY */