From ebd3e9057bfed59761e0554108d541f94eddb835 Mon Sep 17 00:00:00 2001
From: Jan Tomko <jtomko@redhat.com>
Date: Wed, 14 Oct 2020 17:23:54 +0800
Subject: [PATCH] qemu: agent: set ifname to NULL after freeing

CVE-2020-25637

Signed-off-by: Jan Tomko <jtomko@redhat.com>
Rported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reviewed-by: Mauro Matteo Cascella <mcascell@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>

cherry-pick from commit a63b48c5ecef077bf0f909a85f453a605600cf05
Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
---
 src/qemu/qemu_agent.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index d7fcc869c6..31d3268d42 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -2166,6 +2166,7 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
 
         /* Has to be freed for each interface. */
         virStringListFree(ifname);
+        ifname = NULL;
 
         /* as well as IP address which - moreover -
          * can be presented multiple times */
-- 
2.23.0

