From owner-freebsd-current Fri Nov 20 22:38:53 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA15852 for freebsd-current-outgoing; Fri, 20 Nov 1998 22:38:53 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA15846 for ; Fri, 20 Nov 1998 22:38:51 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.1/8.9.1) id WAA21040; Fri, 20 Nov 1998 22:38:16 -0800 (PST) (envelope-from dillon) Date: Fri, 20 Nov 1998 22:38:16 -0800 (PST) From: Matthew Dillon Message-Id: <199811210638.WAA21040@apollo.backplane.com> To: "Justin T. Gibbs" Cc: current@FreeBSD.ORG Subject: Re: snprintf() in the kernel References: <199811210625.XAA05877@narnia.plutotech.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG ::> ::> Boy, weren't we lucky that all BT model names were 4 characters! :: ::Of course they are always 4 characters long. How do you think the programmer ::determined the correct amount of space to allocate for the name information ::in the first place? :: ::-- ::Justin Well, yes, but the obvious problem is that at some future point someone adds a 5-character model and, BEWM. In general, this is why we need either snprintf()'s or very well documented strncpy()'s. None of those strncpy()'s special 'expected' side effects were documented at all, which is bad. They need to be documented if they are going to remain in there. -Matt Matthew Dillon Engineering, HiWay Technologies, Inc. & BEST Internet Communications & God knows what else. (Please include original email in any response) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message