Skip to contentSkip to conversation

[6121] Properly handle the case of SetPixelEncodings with a length of zero.

Qemu-devel Anthony Liguori 1 participant 1 message Dec 22, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 6121

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6121
Author:   aliguori
Date:     2008-12-22 21:06:23 +0000 (Mon, 22 Dec 2008)

Log Message:
-----------
Properly handle the case of SetPixelEncodings with a length of zero.

This commit addresses CORE-2008-1210/CVE-2008-2382.

Modified Paths:
--------------
trunk/vnc.c

Modified: trunk/vnc.c
===================================================================

vnc.c +6 -3
@@ -1503,10 +1503,13 @@
 	if (len == 1)
 	    return 4;
 
-	if (len == 4)
-	    return 4 + (read_u16(data, 2) * 4);
+	if (len == 4) {
+            limit = read_u16(data, 2);
+            if (limit > 0)
+                return 4 + (limit * 4);
+        } else
+            limit = read_u16(data, 2);
 
-	limit = read_u16(data, 2);
 	for (i = 0; i < limit; i++) {
 	    int32_t val = read_s32(data, 4 + (i * 4));
 	    memcpy(data + 4 + (i * 4), &val, sizeof(val));