[PATCH 01/20] testCompareXMLToArgv: Avoid use of uninitialized 'monitor_chr'

Peter Krempa pkrempa at redhat.com
Wed Sep 22 13:02:10 UTC 2021


Failure of 'testQemuInfoInitArgs' jumps over the initialization of
'monitor_chr' via memset, which leads to a crash.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/qemuxml2argvtest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index f0cfca014c..675537b05d 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -642,14 +642,14 @@ testCompareXMLToArgv(const void *data)
     virArch arch = VIR_ARCH_NONE;
     g_autoptr(virIdentity) sysident = virIdentityGetSystem();

+    memset(&monitor_chr, 0, sizeof(monitor_chr));
+
     if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
         goto cleanup;

     if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64)
         qemuTestSetHostArch(&driver, info->arch);

-    memset(&monitor_chr, 0, sizeof(monitor_chr));
-
     if (!(conn = virGetConnect()))
         goto cleanup;

-- 
2.31.1




More information about the libvir-list mailing list