]> xenbits.xensource.com Git - libvirt.git/commitdiff
xenParseXM: don't dereference NULL pointer when script is empty
authorGuido Günther <agx@sigxcpu.org>
Thu, 6 Oct 2011 10:56:52 +0000 (12:56 +0200)
committerGuido Günther <agx@sigxcpu.org>
Thu, 6 Oct 2011 19:04:54 +0000 (21:04 +0200)
src/xenxs/xen_xm.c

index 03857c81e953a86582bf6a94e90c3807783606b0..70facf78d9b0c08421a38508e8ca4c14d49ac139 100644 (file)
@@ -680,8 +680,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
                 }
             }
 
-            if (bridge[0] || STREQ(script, "vif-bridge") ||
-                STREQ(script, "vif-vnic")) {
+            if (bridge[0] || STREQ_NULLABLE(script, "vif-bridge") ||
+                STREQ_NULLABLE(script, "vif-vnic")) {
                 net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
             } else {
                 net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
@@ -698,7 +698,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
                     !(net->data.bridge.ipaddr = strdup(ip)))
                     goto no_memory;
             } else {
-                if (script[0] &&
+                if (script && script[0] &&
                     !(net->data.ethernet.script = strdup(script)))
                     goto no_memory;
                 if (ip[0] &&