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

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