Re: [PATCH 2/2] xenParseXM: don't dereference NULL pointer when script is empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/06/2011 05:36 AM, Guido Günther wrote:
In fact I was looking for that kind of function in hacking.html. New
patch attached.
Cheers,
  -- Guido


0001-xenParseXM-don-t-dereference-NULL-pointer-when-scrip.patch


From 1819f18fbbf0c133a66c93debc117456e940b2bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?=<agx@xxxxxxxxxxx>
Date: Thu, 6 Oct 2011 12:56:52 +0200
Subject: [PATCH] xenParseXM: don't dereference NULL pointer when script is
  empty

---
  src/xenxs/xen_xm.c |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index d057043..6113f33 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -697,8 +697,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;
@@ -715,7 +715,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]&&
-- 1.7.6.3

ACK.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]