This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
RE: [PATCH] strlcat & strlcpy
- From: Mark Bradshaw <bradshaw at staff dot crosswalk dot com>
- To: "'newlib at sources dot redhat dot com'" <newlib at sources dot redhat dot com>
- Date: Mon, 13 May 2002 15:39:19 -0400
- Subject: RE: [PATCH] strlcat & strlcpy
Hadn't thought about that. I'll take a look at it, but I have no tests at
the moment.
> -----Original Message-----
> From: Thomas Fitzsimmons [mailto:fitzsim@redhat.com]
> Sent: Monday, May 13, 2002 3:37 PM
> To: Mark Bradshaw
> Cc: 'newlib@sources.redhat.com'; cygwin-patches@cygwin.com
> Subject: Re: [PATCH] strlcat & strlcpy
>
>
> On Fri, 2002-05-10 at 18:28, Mark Bradshaw wrote:
> > 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
> >
>
> I've applied this, with one change. I moved the string.h declarations
> to the !__STRICT_ANSI__ section of that file.
>
> Do you have any tests for these functions that you would like to
> contribute to our new testsuite?
>
> Tom
>
>
> > ===================
> >
> > 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.
> >
> --
> Thomas Fitzsimmons
> Red Hat Canada Limited e-mail: fitzsim@redhat.com
> 2323 Yonge Street, Suite 300
> Toronto, ON M4P2C9
>