[PATCH 23/23] Avoid use of uninitialized data in virnetmessagetest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

If an error occurs in virnetmessagetest it was possible it
would free uninitialized data.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 tests/virnetmessagetest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/virnetmessagetest.c b/tests/virnetmessagetest.c
index 3c9bead..eabc609 100644
--- a/tests/virnetmessagetest.c
+++ b/tests/virnetmessagetest.c
@@ -327,6 +327,8 @@ static int testMessagePayloadDecode(const void *args ATTRIBUTE_UNUSED)
     };
     int ret = -1;
 
+    memset(&err, 0, sizeof(err));
+
     if (!msg)
         return -1;
 
@@ -334,7 +336,6 @@ static int testMessagePayloadDecode(const void *args ATTRIBUTE_UNUSED)
     if (VIR_ALLOC_N(msg->buffer, msg->bufferLength) < 0)
         goto cleanup;
     memcpy(msg->buffer, input_buffer, msg->bufferLength);
-    memset(&err, 0, sizeof(err));
 
     if (virNetMessageDecodeLength(msg) < 0) {
         VIR_DEBUG("Failed to decode message header");
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]