Avoid a libvirtd crash on broken input 523418
* src/conf/domain_conf.c: a simple typo in an XML domain file could lead to a crash, because we called STRPREFIX() on the looked up value without checking it was non-null.
This commit is contained in:
parent
b37979023d
commit
79d233b5ca
@ -1032,7 +1032,8 @@ virDomainNetDefParseXML(virConnectPtr conn,
|
|||||||
} else if ((ifname == NULL) &&
|
} else if ((ifname == NULL) &&
|
||||||
xmlStrEqual(cur->name, BAD_CAST "target")) {
|
xmlStrEqual(cur->name, BAD_CAST "target")) {
|
||||||
ifname = virXMLPropString(cur, "dev");
|
ifname = virXMLPropString(cur, "dev");
|
||||||
if (STRPREFIX((const char*)ifname, "vnet")) {
|
if ((ifname != NULL) &&
|
||||||
|
(STRPREFIX((const char*)ifname, "vnet"))) {
|
||||||
/* An auto-generated target name, blank it out */
|
/* An auto-generated target name, blank it out */
|
||||||
VIR_FREE(ifname);
|
VIR_FREE(ifname);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user