Blame SOURCES/0003-Xi-avoid-integer-truncation-in-length-check-of-ProcX.patch

b25474
From f9c435822c852659e3926502829f1b13ce6efc37 Mon Sep 17 00:00:00 2001
b25474
From: Peter Hutterer <peter.hutterer@who-t.net>
b25474
Date: Tue, 29 Nov 2022 13:26:57 +1000
b25474
Subject: [PATCH xserver 3/7] Xi: avoid integer truncation in length check of
b25474
 ProcXIChangeProperty
b25474
b25474
This fixes an OOB read and the resulting information disclosure.
b25474
b25474
Length calculation for the request was clipped to a 32-bit integer. With
b25474
the correct stuff->num_items value the expected request size was
b25474
truncated, passing the REQUEST_FIXED_SIZE check.
b25474
b25474
The server then proceeded with reading at least stuff->num_items bytes
b25474
(depending on stuff->format) from the request and stuffing whatever it
b25474
finds into the property. In the process it would also allocate at least
b25474
stuff->num_items bytes, i.e. 4GB.
b25474
b25474
The same bug exists in ProcChangeProperty and ProcXChangeDeviceProperty,
b25474
so let's fix that too.
b25474
b25474
CVE-2022-46344, ZDI-CAN 19405
b25474
b25474
This vulnerability was discovered by:
b25474
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
b25474
b25474
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
b25474
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
b25474
---
b25474
 Xi/xiproperty.c | 4 ++--
b25474
 dix/property.c  | 3 ++-
b25474
 2 files changed, 4 insertions(+), 3 deletions(-)
b25474
b25474
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
b25474
index 68c362c628..066ba21fba 100644
b25474
--- a/Xi/xiproperty.c
b25474
+++ b/Xi/xiproperty.c
b25474
@@ -890,7 +890,7 @@ ProcXChangeDeviceProperty(ClientPtr client)
b25474
     REQUEST(xChangeDevicePropertyReq);
b25474
     DeviceIntPtr dev;
b25474
     unsigned long len;
b25474
-    int totalSize;
b25474
+    uint64_t totalSize;
b25474
     int rc;
b25474
 
b25474
     REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
b25474
@@ -1130,7 +1130,7 @@ ProcXIChangeProperty(ClientPtr client)
b25474
 {
b25474
     int rc;
b25474
     DeviceIntPtr dev;
b25474
-    int totalSize;
b25474
+    uint64_t totalSize;
b25474
     unsigned long len;
b25474
 
b25474
     REQUEST(xXIChangePropertyReq);
b25474
diff --git a/dix/property.c b/dix/property.c
b25474
index 94ef5a0ec0..acce94b2c6 100644
b25474
--- a/dix/property.c
b25474
+++ b/dix/property.c
b25474
@@ -205,7 +205,8 @@ ProcChangeProperty(ClientPtr client)
b25474
     WindowPtr pWin;
b25474
     char format, mode;
b25474
     unsigned long len;
b25474
-    int sizeInBytes, totalSize, err;
b25474
+    int sizeInBytes, err;
b25474
+    uint64_t totalSize;
b25474
 
b25474
     REQUEST(xChangePropertyReq);
b25474
 
b25474
-- 
b25474
2.38.1
b25474