Blob Blame History Raw
From 7bc1491deba6338e514504d1b68fe097e7f2bf19 Mon Sep 17 00:00:00 2001
From: Daniel Veillard <veillard@redhat.com>
Date: Thu, 1 Oct 2009 11:54:38 +0200
Subject: [PATCH] Avoid a libvirtd crash on broken input 523418

* src/conf/domain_conf.c: a simple typo in an XML domain file could lead
  to a crash, because we called STRPREFIX() on the looked up value without
  checking it was non-null.

(cherry picked from commit 79d233b5ca62f86ab22d271d1f08ec20060eee88)

Fedora-patch: libvirt-fix-crash-on-missing-iface-target-dev.patch
---
 src/domain_conf.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/domain_conf.c b/src/domain_conf.c
index c424c67..476cdd7 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -1031,7 +1031,8 @@ virDomainNetDefParseXML(virConnectPtr conn,
             } else if ((ifname == NULL) &&
                        xmlStrEqual(cur->name, BAD_CAST "target")) {
                 ifname = virXMLPropString(cur, "dev");
-                if (STRPREFIX((const char*)ifname, "vnet")) {
+                if ((ifname != NULL) &&
+                    (STRPREFIX((const char*)ifname, "vnet"))) {
                     /* An auto-generated target name, blank it out */
                     VIR_FREE(ifname);
                 }
-- 
1.6.2.5