Date: Fri, 4 Aug 2000 20:28:14 -0700 (PDT) From: Kris Kennaway <kris@FreeBSD.org> To: Garance A Drosihn <drosih@rpi.edu> Cc: Warner Losh <imp@village.org>, Kris Kennaway <kris@hub.freebsd.org>, audit@FreeBSD.ORG Subject: Re: strncpy bugs Message-ID: <Pine.BSF.4.21.0008042027130.63007-100000@freefall.freebsd.org> In-Reply-To: <v04210101b5b13053e745@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 4 Aug 2000, Garance A Drosihn wrote:
> At 3:33 PM -0600 8/4/00, Warner Losh wrote:
> >
> >Usually, I do the following stylaistically:
> > strncpy(dst, src, X);
> > dst[X] = '\0';
> >where X is the size of the buffer minus 1.
> >
> >This goes to show how right Theo de Raadt was with his strlcpy
> >API change :-). Getting this right is too tedious to be left
> >to the user.
>
> So, should we change our habits, and use strlcpy fixes instead
> of repeatedly rewriting strncpy fixes?
strlcpy is definitely easier to use correctly. However, it's probably not
worthwhile replacing correct strncpy usage in most instances.
Kris
--
In God we Trust -- all others must submit an X.509 certificate.
-- Charles Forsythe <forsythe@alum.mit.edu>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0008042027130.63007-100000>
