|
|
6996b1 |
From 96798fc1967491c80a4d0c8d9e0a80586cb2152b Mon Sep 17 00:00:00 2001
|
|
|
6996b1 |
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
|
6996b1 |
Date: Fri, 22 Mar 2024 18:51:45 -0700
|
|
|
6996b1 |
Subject: [PATCH 1/4] Xi: ProcXIGetSelectedEvents needs to use unswapped length
|
|
|
6996b1 |
to send reply
|
|
|
6996b1 |
|
|
|
6996b1 |
CVE-2024-31080
|
|
|
6996b1 |
|
|
|
6996b1 |
Reported-by: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69762
|
|
|
6996b1 |
Fixes: 53e821ab4 ("Xi: add request processing for XIGetSelectedEvents.")
|
|
|
6996b1 |
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
|
6996b1 |
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1463>
|
|
|
6996b1 |
---
|
|
|
6996b1 |
Xi/xiselectev.c | 5 ++++-
|
|
|
6996b1 |
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
6996b1 |
|
|
|
6996b1 |
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
|
|
|
6996b1 |
index edcb8a0d3..ac1494987 100644
|
|
|
6996b1 |
--- a/Xi/xiselectev.c
|
|
|
6996b1 |
+++ b/Xi/xiselectev.c
|
|
|
6996b1 |
@@ -349,6 +349,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
|
|
6996b1 |
InputClientsPtr others = NULL;
|
|
|
6996b1 |
xXIEventMask *evmask = NULL;
|
|
|
6996b1 |
DeviceIntPtr dev;
|
|
|
6996b1 |
+ uint32_t length;
|
|
|
6996b1 |
|
|
|
6996b1 |
REQUEST(xXIGetSelectedEventsReq);
|
|
|
6996b1 |
REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
|
|
|
6996b1 |
@@ -418,10 +419,12 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
|
|
6996b1 |
}
|
|
|
6996b1 |
}
|
|
|
6996b1 |
|
|
|
6996b1 |
+ /* save the value before SRepXIGetSelectedEvents swaps it */
|
|
|
6996b1 |
+ length = reply.length;
|
|
|
6996b1 |
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
|
|
|
6996b1 |
|
|
|
6996b1 |
if (reply.num_masks)
|
|
|
6996b1 |
- WriteToClient(client, reply.length * 4, buffer);
|
|
|
6996b1 |
+ WriteToClient(client, length * 4, buffer);
|
|
|
6996b1 |
|
|
|
6996b1 |
free(buffer);
|
|
|
6996b1 |
return Success;
|
|
|
6996b1 |
--
|
|
|
6996b1 |
2.44.0
|
|
|
6996b1 |
|