From 90cd131f7ee2dda3bf777b8c8f2ed4bc24cd9dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 26 Jul 2013 12:11:21 +0200 Subject: [PATCH] Don't check validity of missing attributes in DNS SRV XML This fixes a crash if one of them is missing. https://bugzilla.redhat.com/show_bug.cgi?id=988718 (cherry picked from commit 461fd86a661f32a9aa8044190b2a63b05290332f) --- src/conf/network_conf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 2b4845ca99..c909756f79 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -931,7 +931,7 @@ virNetworkDNSSrvDefParseXML(const char *networkName, " of network %s"), networkName); goto error; } - if (strlen(def->service) > DNS_RECORD_LENGTH_SRV) { + if (def->service && strlen(def->service) > DNS_RECORD_LENGTH_SRV) { virReportError(VIR_ERR_XML_DETAIL, _("Service name '%s' in network %s is too long, limit is %d bytes"), def->service, networkName, DNS_RECORD_LENGTH_SRV); @@ -947,7 +947,8 @@ virNetworkDNSSrvDefParseXML(const char *networkName, } /* Check whether protocol value is the supported one */ - if (STRNEQ(def->protocol, "tcp") && (STRNEQ(def->protocol, "udp"))) { + if (def->protocol && STRNEQ(def->protocol, "tcp") && + (STRNEQ(def->protocol, "udp"))) { virReportError(VIR_ERR_XML_DETAIL, _("Invalid protocol attribute value '%s' " " in DNS SRV record of network %s"), -- GitLab