Blame SOURCES/0002-xfixes-Fix-out-of-bounds-access-in-ProcXFixesCreateP.patch

823e4a
From 3eb5445f6f7fa9f86de87adc768105d42bdbcf74 Mon Sep 17 00:00:00 2001
823e4a
From: Povilas Kanapickas <povilas@radix.lt>
823e4a
Date: Tue, 14 Dec 2021 15:00:01 +0200
823e4a
Subject: [PATCH xserver 2/4] xfixes: Fix out of bounds access in
823e4a
 *ProcXFixesCreatePointerBarrier()
823e4a
823e4a
ZDI-CAN-14950, CVE-2021-4009
823e4a
823e4a
This vulnerability was discovered and the fix was suggested by:
823e4a
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
823e4a
823e4a
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
823e4a
(cherry picked from commit b5196750099ae6ae582e1f46bd0a6dad29550e02)
823e4a
---
823e4a
 xfixes/cursor.c | 6 ++++--
823e4a
 1 file changed, 4 insertions(+), 2 deletions(-)
823e4a
823e4a
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
823e4a
index 60580b88f..c5d4554b2 100644
823e4a
--- a/xfixes/cursor.c
823e4a
+++ b/xfixes/cursor.c
823e4a
@@ -1010,7 +1010,8 @@ ProcXFixesCreatePointerBarrier(ClientPtr client)
823e4a
 {
823e4a
     REQUEST(xXFixesCreatePointerBarrierReq);
823e4a
 
823e4a
-    REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
823e4a
+    REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq,
823e4a
+                       pad_to_int32(stuff->num_devices * sizeof(CARD16)));
823e4a
     LEGAL_NEW_RESOURCE(stuff->barrier, client);
823e4a
 
823e4a
     return XICreatePointerBarrier(client, stuff);
823e4a
@@ -1027,7 +1028,8 @@ SProcXFixesCreatePointerBarrier(ClientPtr client)
823e4a
 
823e4a
     swaps(&stuff->length);
823e4a
     swaps(&stuff->num_devices);
823e4a
-    REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
823e4a
+    REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq,
823e4a
+                       pad_to_int32(stuff->num_devices * sizeof(CARD16)));
823e4a
 
823e4a
     swapl(&stuff->barrier);
823e4a
     swapl(&stuff->window);
823e4a
-- 
823e4a
2.33.1
823e4a