From 83b85e3e8fa2f2fdc86585787d0db617fe81c710 Mon Sep 17 00:00:00 2001 From: Alex Jia Date: Wed, 29 Aug 2012 10:56:04 +0800 Subject: [PATCH] util: Prevent libvirtd crash from virNetDevOpenvswitchAddPort() * src/util/virnetdevopenvswitch.c (virNetDevOpenvswitchAddPort): avoid libvirtd crash due to derefing a NULL virtVlan->tag. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=852383 Signed-off-by: Alex Jia --- src/util/virnetdevopenvswitch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c index 601d79e629..b903ae4ee6 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -99,7 +99,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, virBufferAddLit(buf, ","); virBufferAsprintf(buf, "%d", virtVlan->tag[i]); } - } else { + } else if (virtVlan->nTags) { virBufferAsprintf(buf, "tag=%d", virtVlan->tag[0]); } } -- GitLab