From owner-cvs-all Mon Sep 2 14:32:59 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 413E037B400; Mon, 2 Sep 2002 14:32:49 -0700 (PDT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id A90FE43E42; Mon, 2 Sep 2002 14:32:48 -0700 (PDT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (IDENT:brdavis@localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.12.3/8.12.3) with ESMTP id g82LWlwu028269; Mon, 2 Sep 2002 14:32:47 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.12.3/8.12.3/Submit) id g82LWkpq028268; Mon, 2 Sep 2002 14:32:46 -0700 Date: Mon, 2 Sep 2002 14:32:46 -0700 From: Brooks Davis To: Juli Mallett Cc: Brooks Davis , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/sys libkern.h src/sys/conf files Message-ID: <20020902143246.A27220@Odin.AC.HMC.Edu> References: <200209022016.g82KGMtv027847@freefall.freebsd.org> <20020902132423.B15010@Odin.AC.HMC.Edu> <20020902142600.B61674@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="dDRMvlgZJXvWKvBx" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020902142600.B61674@FreeBSD.org>; from jmallett@FreeBSD.ORG on Mon, Sep 02, 2002 at 02:26:00PM -0700 X-Virus-Scanned: by amavisd-milter (http://amavis.org/) on odin.ac.hmc.edu Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 02, 2002 at 02:26:00PM -0700, Juli Mallett wrote: > * De: Brooks Davis [ Data: 2002-09-02 ] > [ Subjecte: Re: cvs commit: src/sys/sys libkern.h src/sys/conf files ] > > On Mon, Sep 02, 2002 at 01:16:22PM -0700, Brooks Davis wrote: > > > brooks 2002/09/02 13:16:22 PDT > > >=20 > > > Modified files: > > > sys/sys libkern.h=20 > > > sys/conf files=20 > > > Log: > > > Hook up libkern/strlcpy.c and libkern/strlcat.c after repocopy. > >=20 > > Intrested parties should start attacking uses of strncat and strncpy. > > All uses of strncat in the kernel and most uses of strncpy are either > > wrong or hard to verify and should be converted to strl*. We should be > > able to eliminate strncat fairly easily. strncpy is a bit harder and m= ay > > be used correctly for fixed width, non-NUL-terminated fields so I > > suspect we'll be keeping it around. >=20 > Why? If they're not NUL terminated, use memcpy. Some fixed width fields expect to be zero filled but not necessicairly null-terminated in which case strncpy is the correct function. If there are sufficently few of them and they are in places where performance doesn't matter, then memcpy+bzero could be used. struct utmp is an example of this in userland. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --dDRMvlgZJXvWKvBx Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9c9j+XY6L6fI4GtQRAkA5AKCPLz5qJ7v0UPECRS3x2rZ9Mfp9/ACg5jD2 9pzN1KqmVbe09aozxlbwWkQ= =ccdb -----END PGP SIGNATURE----- --dDRMvlgZJXvWKvBx-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message