From owner-cvs-all Thu May 31 8:37:56 2001 Delivered-To: cvs-all@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 048C337B424; Thu, 31 May 2001 08:37:50 -0700 (PDT) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.9.3/8.9.3) id LAA23815; Thu, 31 May 2001 11:37:31 -0400 (EDT) (envelope-from wollman) Date: Thu, 31 May 2001 11:37:31 -0400 (EDT) From: Garrett Wollman Message-Id: <200105311537.LAA23815@khavrinen.lcs.mit.edu> To: Kris Kennaway 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 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> 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 < 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