From 10ec4fa6e9f1e6c72f2d7a1025d1e200ce94f8b0 Mon Sep 17 00:00:00 2001
From: caozhongwang <caozhongwang1@huawei.com>
Date: Sat, 18 May 2024 17:05:07 +0800
Subject: [PATCH] remote_driver: fix the UAF causing "UnicodeDecodeError:
 'utf-8' codec can't decode byte XXX".

Signed-off-by:xiuqing1 <xiuqing1@huawei.com>
---
 src/remote/remote_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index a1a0edd7a2..9350e811d6 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1408,7 +1408,7 @@ remoteConnectGetType(virConnectPtr conn)
         return NULL;
 
     /* Stash. */
-    return priv->type = ret.type;
+    return priv->type = g_steal_pointer(&ret.type);
 }
 
 static int remoteConnectIsSecure(virConnectPtr conn)
-- 
2.27.0

