mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-27 04:40:06 +01:00
Xext: free the screen saver resource when replacing it
This fixes a use-after-free bug:
When a client first calls ScreenSaverSetAttributes(), a struct
ScreenSaverAttrRec is allocated and added to the client's
resources.
When the same client calls ScreenSaverSetAttributes() again, a new
struct ScreenSaverAttrRec is allocated, replacing the old struct. The
old struct was freed but not removed from the clients resources.
Later, when the client is destroyed the resource system invokes
ScreenSaverFreeAttr and attempts to clean up the already freed struct.
Fix this by letting the resource system free the old attrs instead.
CVE-2022-46343, ZDI-CAN 19404
This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 842ca3ccef)
This commit is contained in:
parent
dc0eddb5ec
commit
2a81326e75
1 changed files with 1 additions and 1 deletions
|
|
@ -1051,7 +1051,7 @@ ScreenSaverSetAttributes(ClientPtr client)
|
|||
pVlist++;
|
||||
}
|
||||
if (pPriv->attr)
|
||||
FreeScreenAttr(pPriv->attr);
|
||||
FreeResource(pPriv->attr->resource, AttrType);
|
||||
pPriv->attr = pAttr;
|
||||
pAttr->resource = FakeClientID(client->index);
|
||||
if (!AddResource(pAttr->resource, AttrType, (void *) pAttr))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue