From 4af718297ad15d2d0cd3f95b690aa122466badea Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 22 Oct 2010 13:28:04 +0100 Subject: [PATCH] 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 --- src/conf/network_conf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index d13f9e06c5..0bc5a5495d 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -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; -- GitLab