]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: parse: Validate that the VM has at least one cpu
authorPeter Krempa <pkrempa@redhat.com>
Mon, 14 Nov 2016 13:46:03 +0000 (14:46 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 21 Nov 2016 13:35:20 +0000 (14:35 +0100)
Libvirt's code relies on this fact so don't allow parsing a command line
which would have none.

Libvirtd would crash in the post parse callback on such config.

src/qemu/qemu_parse_command.c

index c3b27aac8eab14a485658360b26391d830a03fca..b19c523939680e1f59cfa0c5b29053c7254cdfe9 100644 (file)
@@ -1702,6 +1702,9 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
     if (maxcpus == 0)
         maxcpus = vcpus;
 
+    if (maxcpus == 0)
+        goto syntax;
+
     if (virDomainDefSetVcpusMax(dom, maxcpus, xmlopt) < 0)
         goto error;