Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Nov 1998 09:38:17 +1030
From:      Greg Lehey <grog@lemis.com>
To:        Archie Cobbs <archie@whistle.com>, freebsd-current@FreeBSD.ORG
Subject:   Re: snprintf() in the kernel
Message-ID:  <19981120093817.K467@freebie.lemis.com>
In-Reply-To: <199811190712.XAA23068@bubba.whistle.com>; from Archie Cobbs on Wed, Nov 18, 1998 at 11:12:24PM -0800
References:  <199811190712.XAA23068@bubba.whistle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981120093817.K467>