1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

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.
This commit is contained in:
Jim Fehlig 2010-03-31 17:02:57 -06:00 committed by Jiri Denemark
parent f983c32675
commit 320ea3a47e

View File

@ -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;