[Spice-devel] [linux-agent v1 1/5] virtio-port: initialize struct before memcpy

Victor Toso victortoso at redhat.com
Tue Dec 18 16:18:02 UTC 2018


From: Victor Toso <me at victortoso.com>

Found by coverity:

 | uninit_use_in_call: Using uninitialized value "message_header". Field
 | "message_header.data" is uninitialized when calling "memcpy".

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/vdagentd/virtio-port.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vdagentd/virtio-port.c b/src/vdagentd/virtio-port.c
index e48d107..7b148d5 100644
--- a/src/vdagentd/virtio-port.c
+++ b/src/vdagentd/virtio-port.c
@@ -198,7 +198,7 @@ void vdagent_virtio_port_write_start(
 {
     struct vdagent_virtio_port_buf *wbuf, *new_wbuf;
     VDIChunkHeader chunk_header;
-    VDAgentMessage message_header;
+    VDAgentMessage message_header = { 0, };
 
     new_wbuf = g_new(struct vdagent_virtio_port_buf, 1);
     new_wbuf->pos = 0;
-- 
2.19.2



More information about the Spice-devel mailing list