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

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