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

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