Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NHglO-0005LI-Sf for mharc-grub-devel@gnu.org; Mon, 07 Dec 2009 11:48:43 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NHglH-0005Id-V7 for grub-devel@gnu.org; Mon, 07 Dec 2009 11:48:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NHglB-0005G9-CL for grub-devel@gnu.org; Mon, 07 Dec 2009 11:48:34 -0500 Received: from [199.232.76.173] (port=44029 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHgl9-0005Fn-Bb for grub-devel@gnu.org; Mon, 07 Dec 2009 11:48:28 -0500 Received: from smarthost02.mail.zen.net.uk ([212.23.3.141]:58670) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NHgl8-0000ze-Tx for grub-devel@gnu.org; Mon, 07 Dec 2009 11:48:27 -0500 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost02.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1NHgl7-0004ln-Co for grub-devel@gnu.org; Mon, 07 Dec 2009 16:48:25 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1NHgl7-0007sj-00; Mon, 07 Dec 2009 16:48:25 +0000 Date: Mon, 7 Dec 2009 16:48:24 +0000 From: Colin Watson To: The development of GRUB 2 Message-ID: <20091207164824.GF6439@riva.ucam.org> References: <20090902014939.GM13423@riva.ucam.org> <87vdjyac8a.wl%neal@walfield.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87vdjyac8a.wl%neal@walfield.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost02-IP: [82.69.40.219] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [PATCH] Introduce xasprintf X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 16:48:37 -0000 On Fri, Sep 04, 2009 at 06:47:17PM +0200, Neal H. Walfield wrote: > At Wed, 2 Sep 2009 02:49:39 +0100, > Colin Watson wrote: > > +#ifndef HAVE_VASPRINTF > > + > > +int > > +vasprintf (char **buf, const char *fmt, va_list ap) > > +{ > > + /* Should be large enough. */ > > + *buf = xmalloc (512); > > + > > + return vsprintf (*buf, fmt, ap); > > +} > > + > > +#endif > > Perhaps check that the number of characters is not more than 512 (if > so, panic). I agree it's suboptimal, but I'm not sure this is possible without shipping our own vsprintf implementation, which I would like to avoid (gnulib does this properly, but it's much larger). Still, note that my patch didn't really add that xmalloc code - all I did was move it from the asprintf implementation - so this can be dealt with in a further change if we choose. I've gone ahead and committed this, since it's now well past 1.97 and I think this is a clear improvement. Thanks, -- Colin Watson [cjwatson@ubuntu.com]