From owner-freebsd-current Thu Nov 19 15:09:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA04892 for freebsd-current-outgoing; Thu, 19 Nov 1998 15:09:05 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA04876 for ; Thu, 19 Nov 1998 15:08:58 -0800 (PST) (envelope-from grog@freebie.lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.9.1/8.9.0) with ESMTP id JAA21302; Fri, 20 Nov 1998 09:38:18 +1030 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.9.1/8.9.0) id JAA03128; Fri, 20 Nov 1998 09:38:18 +1030 (CST) Message-ID: <19981120093817.K467@freebie.lemis.com> Date: Fri, 20 Nov 1998 09:38:17 +1030 From: Greg Lehey To: Archie Cobbs , freebsd-current@FreeBSD.ORG Subject: Re: snprintf() in the kernel References: <199811190712.XAA23068@bubba.whistle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1i In-Reply-To: <199811190712.XAA23068@bubba.whistle.com>; from Archie Cobbs on Wed, Nov 18, 1998 at 11:12:24PM -0800 WWW-Home-Page: http://www.lemis.com/~grog Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wednesday, 18 November 1998 at 23:12:24 -0800, Archie Cobbs wrote: > I would like to do the following: > > 1. Add snprintf() to kern/subr_prf.c > > 2. Change all appropriate uses of sprintf() and/or strcat() > to use snprintf() instead. > > The main reason for doing this is not to add kernel bloat :-) but > rather to improve the reliability and maintainability of the kernel. > > In fact, the total byte count may even go down due to the several > instances in the code that are forced to do their own bounds checking > (the changes to subr_prf.c are minimal). > > Cases where it's "obvious" that the buffer can't overflow will > be left alone, for some conservative definition of "obvious". > > A typical example: > > ... > > I count 131 files that use sprintf() and 28 that use strcat(), so > this will touch a lot of files (but hopefully for the better). I'm very much in favour. The code I need to do bounds checking in vinum is some of the ugliest I've seen. > So.. does anyone have a huge problem with doing this before I jump in? > [ Anyone willing to review for me? ] I'll take a look. Are you going to implement %qd while you're at it? Greg -- See complete headers for address, home page and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message