wok-current view xorg-server/stuff/CVE-2022-46340.patch @ rev 25640

Patch xorg-server (CVE-2023-6816, CVE-2024-0229, CVE-2024-0408, CVE-2024-0409, CVE-2024-21885, CVE-2024-21886)
author Stanislas Leduc <shann@slitaz.org>
date Tue Jan 16 20:32:03 2024 +0000 (5 months ago)
parents
children
line source
1 From b320ca0ffe4c0c872eeb3a93d9bde21f765c7c63 Mon Sep 17 00:00:00 2001
2 From: Peter Hutterer <peter.hutterer@who-t.net>
3 Date: Tue, 29 Nov 2022 12:55:45 +1000
4 Subject: [PATCH] Xtest: disallow GenericEvents in XTestSwapFakeInput
6 XTestSwapFakeInput assumes all events in this request are
7 sizeof(xEvent) and iterates through these in 32-byte increments.
8 However, a GenericEvent may be of arbitrary length longer than 32 bytes,
9 so any GenericEvent in this list would result in subsequent events to be
10 misparsed.
12 Additional, the swapped event is written into a stack-allocated struct
13 xEvent (size 32 bytes). For any GenericEvent longer than 32 bytes,
14 swapping the event may thus smash the stack like an avocado on toast.
16 Catch this case early and return BadValue for any GenericEvent.
17 Which is what would happen in unswapped setups anyway since XTest
18 doesn't support GenericEvent.
20 CVE-2022-46340, ZDI-CAN 19265
22 This vulnerability was discovered by:
23 Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
25 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
26 Acked-by: Olivier Fourdan <ofourdan@redhat.com>
27 ---
28 Xext/xtest.c | 5 +++--
29 1 file changed, 3 insertions(+), 2 deletions(-)
31 diff --git a/Xext/xtest.c b/Xext/xtest.c
32 index bf27eb590..2985a4ce6 100644
33 --- a/Xext/xtest.c
34 +++ b/Xext/xtest.c
35 @@ -502,10 +502,11 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
37 nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
38 for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) {
39 + int evtype = ev->u.u.type & 0x177;
40 /* Swap event */
41 - proc = EventSwapVector[ev->u.u.type & 0177];
42 + proc = EventSwapVector[evtype];
43 /* no swapping proc; invalid event type? */
44 - if (!proc || proc == NotImplemented) {
45 + if (!proc || proc == NotImplemented || evtype == GenericEvent) {
46 client->errorValue = ev->u.u.type;
47 return BadValue;
48 }
49 --
50 GitLab