Blame SOURCES/0005-Xext-free-the-screen-saver-resource-when-replacing-i.patch

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