Blame SOURCES/0001-xkb-proof-GetCountedString-against-request-length-at.patch

c9925d
From 11beef0b7f1ed290348e45618e5fa0d2bffcb72e Mon Sep 17 00:00:00 2001
c9925d
From: Peter Hutterer <peter.hutterer@who-t.net>
c9925d
Date: Tue, 5 Jul 2022 12:06:20 +1000
c9925d
Subject: [PATCH xserver] xkb: proof GetCountedString against request length
c9925d
 attacks
c9925d
c9925d
GetCountedString did a check for the whole string to be within the
c9925d
request buffer but not for the initial 2 bytes that contain the length
c9925d
field. A swapped client could send a malformed request to trigger a
c9925d
swaps() on those bytes, writing into random memory.
c9925d
c9925d
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
c9925d
---
c9925d
 xkb/xkb.c | 5 +++++
c9925d
 1 file changed, 5 insertions(+)
c9925d
c9925d
diff --git a/xkb/xkb.c b/xkb/xkb.c
c9925d
index f42f59ef3..1841cff26 100644
c9925d
--- a/xkb/xkb.c
c9925d
+++ b/xkb/xkb.c
c9925d
@@ -5137,6 +5137,11 @@ _GetCountedString(char **wire_inout, ClientPtr client, char **str)
c9925d
     CARD16 len;
c9925d
 
c9925d
     wire = *wire_inout;
c9925d
+
c9925d
+    if (client->req_len <
c9925d
+        bytes_to_int32(wire + 2 - (char *) client->requestBuffer))
c9925d
+        return BadValue;
c9925d
+
c9925d
     len = *(CARD16 *) wire;
c9925d
     if (client->swapped) {
c9925d
         swaps(&len;;
c9925d
-- 
c9925d
2.38.1
c9925d