dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0009-vnc-sanitize-bits_per_pixel-from-the-client.patch

725f84
From: Petr Matousek <pmatouse@redhat.com>
725f84
Date: Mon, 27 Oct 2014 12:41:44 +0100
725f84
Subject: [PATCH] vnc: sanitize bits_per_pixel from the client
725f84
725f84
bits_per_pixel that are less than 8 could result in accessing
725f84
non-initialized buffers later in the code due to the expectation
725f84
that bytes_per_pixel value that is used to initialize these buffers is
725f84
never zero.
725f84
725f84
To fix this check that bits_per_pixel from the client is one of the
725f84
values that the rfb protocol specification allows.
725f84
725f84
This is CVE-2014-7815.
725f84
725f84
Signed-off-by: Petr Matousek <pmatouse@redhat.com>
725f84
725f84
[ kraxel: apply codestyle fix ]
725f84
725f84
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
725f84
(cherry picked from commit e6908bfe8e07f2b452e78e677da1b45b1c0f6829)
725f84
---
725f84
 ui/vnc.c | 10 ++++++++++
725f84
 1 file changed, 10 insertions(+)
725f84
725f84
diff --git a/ui/vnc.c b/ui/vnc.c
725f84
index f8d9b7d..87e34ae 100644
725f84
--- a/ui/vnc.c
725f84
+++ b/ui/vnc.c
725f84
@@ -2026,6 +2026,16 @@ static void set_pixel_format(VncState *vs,
725f84
         return;
725f84
     }
725f84
 
725f84
+    switch (bits_per_pixel) {
725f84
+    case 8:
725f84
+    case 16:
725f84
+    case 32:
725f84
+        break;
725f84
+    default:
725f84
+        vnc_client_error(vs);
725f84
+        return;
725f84
+    }
725f84
+
725f84
     vs->client_pf.rmax = red_max;
725f84
     vs->client_pf.rbits = hweight_long(red_max);
725f84
     vs->client_pf.rshift = red_shift;