mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
Xi: don't try to set oversized or non-existing masks.
Fixes crash if the first XISelectEvents has a zero sized event mask. Fixes crash if the mask provided is larger than others->xi2mask[]. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -2148,15 +2148,18 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
|
||||
}
|
||||
}
|
||||
|
||||
if (!others && len)
|
||||
len = min(len, sizeof(others->xi2mask[dev->id]));
|
||||
|
||||
if (len && !others)
|
||||
{
|
||||
AddExtensionClient(win, client, 0, 0);
|
||||
others= wOtherInputMasks(win)->inputClients;
|
||||
}
|
||||
|
||||
if (!len)
|
||||
if (others)
|
||||
memset(others->xi2mask[dev->id], 0, sizeof(others->xi2mask[dev->id]));
|
||||
else
|
||||
|
||||
if (len)
|
||||
memcpy(others->xi2mask[dev->id], mask, len);
|
||||
|
||||
RecalculateDeviceDeliverableEvents(win);
|
||||
|
||||
Reference in New Issue
Block a user