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

2936a4
From a8644465d98beb08759546711b77bb617861c67f Mon Sep 17 00:00:00 2001
2936a4
From: Povilas Kanapickas <povilas@radix.lt>
2936a4
Date: Tue, 14 Dec 2021 15:00:00 +0200
2936a4
Subject: [PATCH xserver 1/4] record: Fix out of bounds access in
2936a4
 SwapCreateRegister()
2936a4
2936a4
ZDI-CAN-14952, CVE-2021-4011
2936a4
2936a4
This vulnerability was discovered and the fix was suggested by:
2936a4
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
2936a4
2936a4
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2936a4
(cherry picked from commit e56f61c79fc3cee26d83cda0f84ae56d5979f768)
2936a4
---
2936a4
 record/record.c | 4 ++--
2936a4
 1 file changed, 2 insertions(+), 2 deletions(-)
2936a4
2936a4
diff --git a/record/record.c b/record/record.c
2936a4
index be154525d..e123867a7 100644
2936a4
--- a/record/record.c
2936a4
+++ b/record/record.c
2936a4
@@ -2516,8 +2516,8 @@ SwapCreateRegister(ClientPtr client, xRecordRegisterClientsReq * stuff)
2936a4
         swapl(pClientID);
2936a4
     }
2936a4
     if (stuff->nRanges >
2936a4
-        client->req_len - bytes_to_int32(sz_xRecordRegisterClientsReq)
2936a4
-        - stuff->nClients)
2936a4
+        (client->req_len - bytes_to_int32(sz_xRecordRegisterClientsReq)
2936a4
+        - stuff->nClients) / bytes_to_int32(sz_xRecordRange))
2936a4
         return BadLength;
2936a4
     RecordSwapRanges((xRecordRange *) pClientID, stuff->nRanges);
2936a4
     return Success;
2936a4
-- 
2936a4
2.33.1
2936a4