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

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