mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-06 13:03:36 +00:00
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user