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

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