Here's a patch to cygwin and newlib that adds the functions strlcat and strlcpy. These functions are replacement functions for strncat and strncpy. They were created by the OpenBSD team to address buffer overflow problems that can happen so easily when using the "n" versions. Some other OS's have picked them up already, and software packages have begun to use them when available. Aside from security benefits there are also performance benefits. Strlcat is much faster than strncat, due to strncat's penchant for padding the destination string.
The original source for these two come from OpenBSD. You can find them here: http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/ A good discussion of the new functions can be found here: http://www.courtesan.com/todd/papers/strlcpy.html =================== For newlib: 2002-05-10 Mark Bradshaw <[EMAIL PROTECTED]> * libc/include/string.h: Add strlcat and strlcpy. * libc/string/Makefile.am: Add strlcat.c and strlcpy.c. * libc/string/strlcat.c: New file. * libc/string/strlcpy.c: New file. For cygwin: 2002-05-10 Mark Bradshaw <[EMAIL PROTECTED]> * cygwin.din: Add strlcat and strlcpy. * include/cygwin/version.h: Increment API minor version number.
cygwin.diff
Description: Binary data
newlib.diff
Description: Binary data
