xorg-x11-server-Xwayland/0004-xfixes-Check-request-length-for-SetClientDisconnectM.patch

52 lines
1.7 KiB
Diff

From ee2447ebdb1c4f499e809dfbb6eeed4af5f3bfdf Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 28 Apr 2025 10:05:36 +0200
Subject: [PATCH 4/7] xfixes: Check request length for SetClientDisconnectMode
The handler of XFixesSetClientDisconnectMode does not check the client
request length.
A client could send a shorter request and read data from a former
request.
Fix the issue by checking the request size matches.
CVE-2025-49177
This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.
Fixes: e167299f6 - xfixes: Add ClientDisconnectMode
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ab02fb96b1c701c3bb47617d965522c34befa6af)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2026>
---
xfixes/disconnect.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xfixes/disconnect.c b/xfixes/disconnect.c
index e412942..b3529af 100644
--- a/xfixes/disconnect.c
+++ b/xfixes/disconnect.c
@@ -69,6 +69,7 @@ ProcXFixesSetClientDisconnectMode(ClientPtr client)
ClientDisconnectPtr pDisconnect = GetClientDisconnect(client);
REQUEST(xXFixesSetClientDisconnectModeReq);
+ REQUEST_SIZE_MATCH(xXFixesSetClientDisconnectModeReq);
pDisconnect->disconnect_mode = stuff->disconnect_mode;
@@ -82,7 +83,7 @@ SProcXFixesSetClientDisconnectMode(ClientPtr client)
swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE(xXFixesSetClientDisconnectModeReq);
+ REQUEST_SIZE_MATCH(xXFixesSetClientDisconnectModeReq);
swapl(&stuff->disconnect_mode);
--
2.49.0