cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 9aeb00acc02f49c754f0bbde5894b45b41407f63 Mon Sep 17 00:00:00 2001
9ae3a8
From: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Date: Tue, 18 Nov 2014 11:58:56 +0100
9ae3a8
Subject: [PATCH 33/41] vnc: sanitize bits_per_pixel from the client
9ae3a8
9ae3a8
Message-id: <1416311936-5001-2-git-send-email-kraxel@redhat.com>
9ae3a8
Patchwork-id: 62424
9ae3a8
O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] vnc: sanitize bits_per_pixel from the client
9ae3a8
Bugzilla: 1157645
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
9ae3a8
9ae3a8
From: Petr Matousek <pmatouse@redhat.com>
9ae3a8
9ae3a8
bits_per_pixel that are less than 8 could result in accessing
9ae3a8
non-initialized buffers later in the code due to the expectation
9ae3a8
that bytes_per_pixel value that is used to initialize these buffers is
9ae3a8
never zero.
9ae3a8
9ae3a8
To fix this check that bits_per_pixel from the client is one of the
9ae3a8
values that the rfb protocol specification allows.
9ae3a8
9ae3a8
This is CVE-2014-7815.
9ae3a8
9ae3a8
Signed-off-by: Petr Matousek <pmatouse@redhat.com>
9ae3a8
9ae3a8
[ kraxel: apply codestyle fix ]
9ae3a8
9ae3a8
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
(cherry picked from commit e6908bfe8e07f2b452e78e677da1b45b1c0f6829)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 ui/vnc.c | 10 ++++++++++
9ae3a8
 1 file changed, 10 insertions(+)
9ae3a8
9ae3a8
diff --git a/ui/vnc.c b/ui/vnc.c
9ae3a8
index 3726352..a0e2d33 100644
9ae3a8
--- a/ui/vnc.c
9ae3a8
+++ b/ui/vnc.c
9ae3a8
@@ -2024,6 +2024,16 @@ static void set_pixel_format(VncState *vs,
9ae3a8
         return;
9ae3a8
     }
9ae3a8
 
9ae3a8
+    switch (bits_per_pixel) {
9ae3a8
+    case 8:
9ae3a8
+    case 16:
9ae3a8
+    case 32:
9ae3a8
+        break;
9ae3a8
+    default:
9ae3a8
+        vnc_client_error(vs);
9ae3a8
+        return;
9ae3a8
+    }
9ae3a8
+
9ae3a8
     vs->client_pf.rmax = red_max;
9ae3a8
     vs->client_pf.rbits = hweight_long(red_max);
9ae3a8
     vs->client_pf.rshift = red_shift;
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8