Date: Thu, 31 May 2001 11:37:31 -0400 (EDT) From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> To: Kris Kennaway <kris@obsecurity.org> Cc: 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: <200105311537.LAA23815@khavrinen.lcs.mit.edu> In-Reply-To: <20010530182822.A79068@xor.obsecurity.org> References: <200105252042.f4PKgfu84635@freefall.freebsd.org> <20010526004601.2109A3E2F@bazooka.unixfreak.org> <20010530172131.A60056@FreeBSD.org> <20010530182822.A79068@xor.obsecurity.org>
next in thread | previous in thread | raw e-mail | index | archive | help
<<On Wed, 30 May 2001 18:28:22 -0700, Kris Kennaway <kris@obsecurity.org> said:
> things like how to use strncpy() properly
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.
> whether to use array[FOO_MAX] or array[FOO_MAX+1] for proper
> bounding of buffers passed to library (e.g. POSIX) functions, etc.
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}.
-GAWollman
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?200105311537.LAA23815>
