|
|
72411e |
From 94f6fe99d87cf6ba0adadd95c595158c345b7d29 Mon Sep 17 00:00:00 2001
|
|
|
72411e |
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
72411e |
Date: Tue, 29 Nov 2022 14:53:07 +1000
|
|
|
72411e |
Subject: [PATCH xserver 5/7] Xext: free the screen saver resource when
|
|
|
72411e |
replacing it
|
|
|
72411e |
|
|
|
72411e |
This fixes a use-after-free bug:
|
|
|
72411e |
|
|
|
72411e |
When a client first calls ScreenSaverSetAttributes(), a struct
|
|
|
72411e |
ScreenSaverAttrRec is allocated and added to the client's
|
|
|
72411e |
resources.
|
|
|
72411e |
|
|
|
72411e |
When the same client calls ScreenSaverSetAttributes() again, a new
|
|
|
72411e |
struct ScreenSaverAttrRec is allocated, replacing the old struct. The
|
|
|
72411e |
old struct was freed but not removed from the clients resources.
|
|
|
72411e |
|
|
|
72411e |
Later, when the client is destroyed the resource system invokes
|
|
|
72411e |
ScreenSaverFreeAttr and attempts to clean up the already freed struct.
|
|
|
72411e |
|
|
|
72411e |
Fix this by letting the resource system free the old attrs instead.
|
|
|
72411e |
|
|
|
72411e |
CVE-2022-46343, ZDI-CAN 19404
|
|
|
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 |
Xext/saver.c | 2 +-
|
|
|
72411e |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
72411e |
|
|
|
72411e |
diff --git a/Xext/saver.c b/Xext/saver.c
|
|
|
72411e |
index f813ba08d1..fd6153c313 100644
|
|
|
72411e |
--- a/Xext/saver.c
|
|
|
72411e |
+++ b/Xext/saver.c
|
|
|
72411e |
@@ -1051,7 +1051,7 @@ ScreenSaverSetAttributes(ClientPtr client)
|
|
|
72411e |
pVlist++;
|
|
|
72411e |
}
|
|
|
72411e |
if (pPriv->attr)
|
|
|
72411e |
- FreeScreenAttr(pPriv->attr);
|
|
|
72411e |
+ FreeResource(pPriv->attr->resource, AttrType);
|
|
|
72411e |
pPriv->attr = pAttr;
|
|
|
72411e |
pAttr->resource = FakeClientID(client->index);
|
|
|
72411e |
if (!AddResource(pAttr->resource, AttrType, (void *) pAttr))
|
|
|
72411e |
--
|
|
|
72411e |
2.38.1
|