]> git.proxmox.com Git - mirror_qemu.git/commitdiff
virtio-gpu: fix information leak in capset get dispatch
authorLi Qiang <liqiang6-s@360.cn>
Tue, 1 Nov 2016 12:37:57 +0000 (05:37 -0700)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 11 Jan 2017 08:19:05 +0000 (09:19 +0100)
In virgl_cmd_get_capset function, it uses g_malloc to allocate
a response struct to the guest. As the 'resp'struct hasn't been full
initialized it will lead the 'resp->padding' field to the guest.
Use g_malloc0 to avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 58188cae.4a6ec20a.3d2d1.aff2@mx.google.com

[ kraxel: resolved conflict ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/display/virtio-gpu-3d.c

index b13ced38faca69d1f66de885ce901c004ace0edf..f96a0c2e590d803c5a7b9b7fa86e0db40b5a29f1 100644 (file)
@@ -379,7 +379,7 @@ static void virgl_cmd_get_capset(VirtIOGPU *g,
         return;
     }
 
-    resp = g_malloc(sizeof(*resp) + max_size);
+    resp = g_malloc0(sizeof(*resp) + max_size);
     resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET;
     virgl_renderer_fill_caps(gc.capset_id,
                              gc.capset_version,