summaryrefslogtreecommitdiff
path: root/Xi/xiselectev.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-09 16:57:09 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-06-11 13:39:48 +1000
commit9563feeeb5309de1971c4e04419fed6fd31c9cea (patch)
tree1ab80c74b2500930e191316fb364e08726115f94 /Xi/xiselectev.c
parente2fbaebb87e18198143a4b8e6be7e650563cd819 (diff)
Xi: start checking for invalid mask bits _after_ LASTEVENT.
Two issues that combined to false positives and false negatives. - The checking for invalid bits must be performed when there are enough bits that an event outside of LASTEVENT may be selected. - The first invalid bit is LASTEVENT + 1, not LASTEVENT. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi/xiselectev.c')
-rw-r--r--Xi/xiselectev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 6734da991..98b591901 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -108,10 +108,10 @@ ProcXISelectEvent(ClientPtr client)
return BadValue;
}
- if ((evmask->mask_len * 4) > XI_LASTEVENT)
+ if ((evmask->mask_len * 4) >= (XI_LASTEVENT + 8)/8)
{
unsigned char *bits = (unsigned char*)&evmask[1];
- for (i = XI_LASTEVENT; i < evmask->mask_len * 4; i++)
+ for (i = XI_LASTEVENT + 1; i < evmask->mask_len * 4; i++)
{
if (BitIsOn(bits, i))
return BadValue;