On 09/02/2010 05:43 AM, Matthias Bolte wrote:
- /* Assuming can't have more then 9999 devices so
- * restricting to %04d
+ /* Zero pad for nice alignment when fewer than 9999
+ * devices.
*/
- sprintf(filtername, "filter%04d", i);
- VBOX_UTF8_TO_UTF16(filtername,&filternameUtf16);
+ if (virAsprintf(&filtername, "filter%04d", i)< 0) {
+ virReportOOMError();
+ } else {
+ VBOX_UTF8_TO_UTF16(filtername,&filternameUtf16);
+ VIR_FREE(filtername);
+ }
USBController->vtbl->CreateDeviceFilter(USBController,
filternameUtf16,
In case virAsprintf fails CreateDeviceFilter will be called with
filternameUtf16 = NULL, that might trigger a segfault.
Good catch. I'll respin this patch as part of my round 3 cleanups (more
openvz_driver changes, and virsh.c, still to come). It may be another
day or two...
--
Eric Blake eblake@xxxxxxxxxx +1-801-349-2682
Libvirt virtualization library http://libvirt.org
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list