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

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