[RFC PATCH 33/35] Add the Xenbus sysfs and virtual device hotplug driver.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 09 May 2006 18:06, Alexey Dobriyan wrote:
> > +/* Simplified asprintf. */
> > +char *kasprintf(const char *fmt, ...)
> > +{
> > +	va_list ap;
> > +	unsigned int len;
> > +	char *p, dummy[1];
> > +
> > +	va_start(ap, fmt);
> > +	/* FIXME: vsnprintf has a bug, NULL should work */
> > +	len = vsnprintf(dummy, 0, fmt, ap);
> > +	va_end(ap);
> > +
> > +	p = kmalloc(len + 1, GFP_KERNEL);
> > +	if (!p)
> > +		return NULL;
> > +	va_start(ap, fmt);
> > +	vsprintf(p, fmt, ap);
> > +	va_end(ap);
> > +	return p;
> > +}
> 
> This should go to lib/

First for kernel usage I think it should have a maximum length parameter
to avoid dumb code from being easily exploited.

And the bug should be fixed in vsnprintf instead of being worked
around.

-Andi

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux