mirror of https://gitee.com/openkylin/libvirt.git
Don't try to parse a NULL ip address for boot server
The boot server IP address is optional, so it needs to be checked before attempting to parse it. * src/conf/network_conf.c: Don't parse NULL ip address for boot server
This commit is contained in:
parent
090404acfe
commit
4af718297a
|
@ -317,6 +317,7 @@ virNetworkDHCPRangeDefParseXML(virNetworkDefPtr def,
|
|||
xmlChar *file;
|
||||
xmlChar *server;
|
||||
virSocketAddr inaddr;
|
||||
memset(&inaddr, 0, sizeof(inaddr));
|
||||
|
||||
if (!(file = xmlGetProp(cur, BAD_CAST "file"))) {
|
||||
cur = cur->next;
|
||||
|
@ -324,7 +325,8 @@ virNetworkDHCPRangeDefParseXML(virNetworkDefPtr def,
|
|||
}
|
||||
server = xmlGetProp(cur, BAD_CAST "server");
|
||||
|
||||
if (virSocketParseAddr((const char *)server, &inaddr, AF_UNSPEC) < 0)
|
||||
if (server &&
|
||||
virSocketParseAddr((const char *)server, &inaddr, AF_UNSPEC) < 0)
|
||||
return -1;
|
||||
|
||||
def->bootfile = (char *)file;
|
||||
|
|
Loading…
Reference in New Issue