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                                       [cjwat...@ubuntu.com]


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to