This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] strlcat & strlcpy


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  <bradshaw@staff.crosswalk.com>
        * 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  <bradshaw@staff.crosswalk.com>

	  * cygwin.din: Add strlcat and strlcpy.
	  * include/cygwin/version.h: Increment API minor version number.

Attachment: cygwin.diff
Description: Binary data

Attachment: newlib.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]