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

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