From: Jim Fehlig Date: Wed, 31 Mar 2010 23:02:57 +0000 (-0600) Subject: Only parse 'CPU XML' in virCPUDefParseXML() X-Git-Tag: v0.8.0~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=320ea3a47ec7a2ff82615cdb39b682ef50623da0;p=thirdparty%2Flibvirt.git 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 cf91930365..c51ac4e752 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;