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

Daniel P. Berrange berrange at redhat.com
Tue Aug 24 11:18:48 UTC 2010


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 :-)

Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list