diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-09-01 15:58:02 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-09-03 08:39:26 +1000 |
commit | 83db2b126e8623824e1303e74070375994984599 (patch) | |
tree | d39118c1a02a7dceeec907614a5a9435fa9d0e90 | |
parent | 6fe235d3635aaf995dfa198c60ded1a43fe9dd45 (diff) |
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>
-rw-r--r-- | Xi/exevents.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index 2173f354a..b1412f018 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -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); |