]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Don't check validity of missing attributes in DNS SRV XML
authorJán Tomko <jtomko@redhat.com>
Fri, 26 Jul 2013 10:11:21 +0000 (12:11 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 1 Aug 2013 15:14:27 +0000 (17:14 +0200)
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

index d910a279feaeb6529262a8301e7ded1d0f527a2a..ae7a8603b16454baf872ea83e346e37db6b7f186 100644 (file)
@@ -920,7 +920,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);
@@ -936,7 +936,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"),