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

[Libvir] PATCH: Check for bogus default architecture



There was a missing check in the QEMU driver for a bogus architecture in 
the XML which could cause a crash. This wasn't a problem except for the
fact that another bug in my recent virt-install 0.200.0 release passed a
bogus architecture on 32-bit platforms :-(

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
diff -rup libvirt-0.3.1.orig/src/qemu_conf.c libvirt-0.3.1.new/src/qemu_conf.c
--- libvirt-0.3.1.orig/src/qemu_conf.c	2007-07-24 11:06:38.000000000 -0400
+++ libvirt-0.3.1.new/src/qemu_conf.c	2007-07-26 10:22:09.000000000 -0400
@@ -1088,6 +1088,10 @@ static struct qemud_vm_def *qemudParseXM
     if ((obj == NULL) || (obj->type != XPATH_STRING) ||
         (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
         const char *defaultMachine = qemudDefaultMachineForArch(def->os.arch);
+        if (!defaultMachine) {
+            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "unsupported arch %s", def->os.arch);
+            goto error;
+        }
         if (strlen(defaultMachine) >= (QEMUD_OS_MACHINE_MAX_LEN-1)) {
             qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "machine type too long");
             goto error;

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