[libvirt] [PATCH] Fix off-by-1 in QEMU boot arg array handling

Daniel Veillard veillard at redhat.com
Tue Aug 24 11:30:27 UTC 2010


On Tue, Aug 24, 2010 at 12:18:48PM +0100, Daniel P. Berrange wrote:
> On Tue, Aug 24, 2010 at 12:02:38PM +0100, Daniel P. Berrange wrote:
> > A QEMU guest can have upto VIR_DOMAIN_BOOT_LAST boot entries
> > defined. When building the QEMU arg, each entry takes a
> > single byte. This means the array must be declared to be
> > VIR_DOMAIN_BOOT_LAST+1 bytes in length to allow for the
> > trailing null
> 
> FYI, This bug was introduced by me 2 years ago during the conversion
> to common domain APIs. In 6385fe3edebf4593b6dc08eee086f73dcc71b43d.
> We already have a test case that covers this precise boundary 
> condition, but it has never exhibited a problem, even under valgrind.
> In Fedora 15 rawhide though, there is more advanced GCC array bounds
> checking present and this causes a runtime abort in the test suite.
> Nice example of why running 'make check' in the RPM spec is good :-)

  There used to be a 'checker' version of gcc with specific patches for
bound-checking a decade or so ago, good to see this coming to the main
stream :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list