commit 93d68602a9701dc6f6b4f4b20eaac7159c8d3be7
Author: Jim Fehlig <jfehlig(a)novell.com>
Date: Wed Mar 31 17:02:57 2010 -0600
Only parse 'CPU XML' in virCPUDefParseXML()
Received report of user crashing libvirtd with
virsh capabilities > capabilities.xml
virsh cpu-compare capabilities.xml
While user has been informed about proper usage of cpu-compare,
segfaulting libvirt should be avoided.
Do not parse CPU definition in virCPUDefParseXML() if XML is not
a 'cpu' node.
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index cf91930..c51ac4e 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -115,6 +115,13 @@ virCPUDefParseXML(const xmlNodePtr node,
int n;
unsigned int i;
+ if (!xmlStrEqual(node->name, BAD_CAST "cpu")) {
+ virCPUReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s",
+ _("XML does not contain expected 'cpu'
element"));
+ return NULL;
+ }
+
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
return NULL;
Sure that makes perfect sense. Thanks for the fix. ACK.
Jirka