From owner-freebsd-current Fri Nov 20 22:33:42 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA15477 for freebsd-current-outgoing; Fri, 20 Nov 1998 22:33:42 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from narnia.plutotech.com (narnia.plutotech.com [206.168.67.130]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA15471 for ; Fri, 20 Nov 1998 22:33:41 -0800 (PST) (envelope-from gibbs@narnia.plutotech.com) Received: (from gibbs@localhost) by narnia.plutotech.com (8.9.1/8.7.3) id XAA05877; Fri, 20 Nov 1998 23:25:51 -0700 (MST) Date: Fri, 20 Nov 1998 23:25:51 -0700 (MST) From: "Justin T. Gibbs" Message-Id: <199811210625.XAA05877@narnia.plutotech.com> To: Matthew Dillon cc: current@FreeBSD.ORG Subject: Re: snprintf() in the kernel X-Newsgroups: pluto.freebsd.current In-Reply-To: <199811210312.TAA25314@bubba.whistle.com> <199811210407.UAA20321@apollo.backplane.com> <199811210537.VAA20822@apollo.backplane.com> User-Agent: tin/pre-1.4-980818 ("Laura") (UNIX) (FreeBSD/3.0-BETA (i386)) Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article <199811210537.VAA20822@apollo.backplane.com> you wrote: > General comments: ... > * noticed a few bugs in the original code were fixed, kudos! For > example, a number of strncpy()'s assume zero-termination. strncpy() > does not zero-terminate in the exact-length case. Exactly. Many of the uses of strncpy removed from the CAM code fall into this category. > cam/scsi/scsi_all.c > > line 1566, char holdstr[8] was totally broken anyway, it wasn't big > enough (needs to be 10). Your patch removes it which is good. > A second bug fixed! Last I checked, an unsigned byte value represented in hex took 2 bytes. The space and the null terminator add 2 more bytes. That makes holdstr too big by 4 bytes. > dev/buslogin/bt.c > > 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message