From owner-cvs-all Thu May 31 11:54:28 2001 Delivered-To: cvs-all@freebsd.org Received: from obsecurity.dyndns.org (adsl-63-207-60-66.dsl.lsan03.pacbell.net [63.207.60.66]) by hub.freebsd.org (Postfix) with ESMTP id 3AF4C37B422; Thu, 31 May 2001 11:54:19 -0700 (PDT) (envelope-from kris@obsecurity.org) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id DCFAA678A4; Thu, 31 May 2001 11:54:18 -0700 (PDT) Date: Thu, 31 May 2001 11:54:18 -0700 From: Kris Kennaway To: Garrett Wollman Cc: Kris Kennaway , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libc/gen setproctitle.3 syslog.3 src/lib/libc/stdio printf.3 Message-ID: <20010531115418.B96927@xor.obsecurity.org> References: <200105252042.f4PKgfu84635@freefall.freebsd.org> <20010526004601.2109A3E2F@bazooka.unixfreak.org> <20010530172131.A60056@FreeBSD.org> <20010530182822.A79068@xor.obsecurity.org> <200105311537.LAA23815@khavrinen.lcs.mit.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="24zk1gE8NUlDmwG9" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200105311537.LAA23815@khavrinen.lcs.mit.edu>; from wollman@khavrinen.lcs.mit.edu on Thu, May 31, 2001 at 11:37:31AM -0400 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 --24zk1gE8NUlDmwG9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 31, 2001 at 11:37:31AM -0400, Garrett Wollman wrote: > <= said: >=20 > > things like how to use strncpy() properly >=20 > Mostly, ``don't.'' In almost every case where you think you might > want to use strncpy(), strncat() is -- despite its name -- the correct > function to use. Not Helpful. People use the function and will do so forever, so we should explain how to use it correctly. > > whether to use array[FOO_MAX] or array[FOO_MAX+1] for proper > > bounding of buffers passed to library (e.g. POSIX) functions, etc. >=20 > That one's pretty easy: ``consult the Standard to see how {FOO_MAX} is > defined.'' Unless, of course, you want to enumerate the cases for > each an every {FOO_MAX} in POSIX. In any case, the Standard will > often tell you that {FOO_MAX} might not be defined at all, and > portable programs should be prepared to call sysconf() or pathconf() > to find out the real value, or else assume the worst-case > {_POSIX_FOO_MAX}. Not Helpful. The point here is to compile a set of useful, practical advice to solve problems which recur again and again even in new code. Kris --24zk1gE8NUlDmwG9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7FpNZWry0BWjoQKURAnuMAKDcOatUkowrm+56gsgTRIP8bauuqQCfX4zz a6QvYSYYOyCKlp+8jCvRgW0= =5vjs -----END PGP SIGNATURE----- --24zk1gE8NUlDmwG9-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message