File 6dd8532d-parse-xm.patch of Package libvirt.1301

commit 6dd8532d96b0512ddb3b10cae8f51e16389d9cc7
Author: Guido Günther <agx@sigxcpu.org>
Date:   Thu Oct 6 12:56:52 2011 +0200

    xenParseXM: don't dereference NULL pointer when script is empty

Index: libvirt-0.9.6/src/xenxs/xen_xm.c
===================================================================
--- libvirt-0.9.6.orig/src/xenxs/xen_xm.c
+++ libvirt-0.9.6/src/xenxs/xen_xm.c
@@ -680,8 +680,8 @@ xenParseXM(virConfPtr conf, int xendConf
                 }
             }
 
-            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;
@@ -691,14 +691,14 @@ xenParseXM(virConfPtr conf, int xendConf
                 if (bridge[0] &&
                     !(net->data.bridge.brname = strdup(bridge)))
                     goto no_memory;
-                if (script[0] &&
+                if (script && script[0] &&
                     !(net->data.bridge.script = strdup(script)))
                     goto no_memory;
                 if (ip[0] &&
                     !(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] &&
openSUSE Build Service is sponsored by