From: Mauro Matteo Cascella <mcasc...@redhat.com> Avoid fetching 'width' and 'height' a second time to prevent possible race condition. Refer to security advisory https://starlabs.sg/advisories/22-4207/ for more information.
Fixes: CVE-2021-4207 Signed-off-by: Mauro Matteo Cascella <mcasc...@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> Message-Id: <20220407081106.343235-1-mcasc...@redhat.com> Signed-off-by: Gerd Hoffmann <kra...@redhat.com> --- hw/display/qxl-render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c index d28849b12176..237ed293baae 100644 --- a/hw/display/qxl-render.c +++ b/hw/display/qxl-render.c @@ -266,7 +266,7 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor, } break; case SPICE_CURSOR_TYPE_ALPHA: - size = sizeof(uint32_t) * cursor->header.width * cursor->header.height; + size = sizeof(uint32_t) * c->width * c->height; qxl_unpack_chunks(c->data, size, qxl, &cursor->chunk, group_id); if (qxl->debug > 2) { cursor_print_ascii_art(c, "qxl/alpha"); -- 2.35.1