Blame SOURCES/0001-record-Fix-out-of-bounds-access-in-SwapCreateRegiste.patch

823e4a
From a8644465d98beb08759546711b77bb617861c67f Mon Sep 17 00:00:00 2001
823e4a
From: Povilas Kanapickas <povilas@radix.lt>
823e4a
Date: Tue, 14 Dec 2021 15:00:00 +0200
823e4a
Subject: [PATCH xserver 1/4] record: Fix out of bounds access in
823e4a
 SwapCreateRegister()
823e4a
823e4a
ZDI-CAN-14952, CVE-2021-4011
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 e56f61c79fc3cee26d83cda0f84ae56d5979f768)
823e4a
---
823e4a
 record/record.c | 4 ++--
823e4a
 1 file changed, 2 insertions(+), 2 deletions(-)
823e4a
823e4a
diff --git a/record/record.c b/record/record.c
823e4a
index be154525d..e123867a7 100644
823e4a
--- a/record/record.c
823e4a
+++ b/record/record.c
823e4a
@@ -2516,8 +2516,8 @@ SwapCreateRegister(ClientPtr client, xRecordRegisterClientsReq * stuff)
823e4a
         swapl(pClientID);
823e4a
     }
823e4a
     if (stuff->nRanges >
823e4a
-        client->req_len - bytes_to_int32(sz_xRecordRegisterClientsReq)
823e4a
-        - stuff->nClients)
823e4a
+        (client->req_len - bytes_to_int32(sz_xRecordRegisterClientsReq)
823e4a
+        - stuff->nClients) / bytes_to_int32(sz_xRecordRange))
823e4a
         return BadLength;
823e4a
     RecordSwapRanges((xRecordRange *) pClientID, stuff->nRanges);
823e4a
     return Success;
823e4a
-- 
823e4a
2.33.1
823e4a