Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 May 2001 11:54:18 -0700
From:      Kris Kennaway <kris@obsecurity.org>
To:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
Cc:        Kris Kennaway <kris@obsecurity.org>, 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>
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
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>

next in thread | previous in thread | raw e-mail | index | archive | help

--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:
> <<On Wed, 30 May 2001 18:28:22 -0700, Kris Kennaway <kris@obsecurity.org>=
 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010531115418.B96927>