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:
Peter Hutterer 2009-09-01 15:58:02 +10:00
parent 6fe235d363
commit 83db2b126e

View File

@ -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);