diff options
Diffstat (limited to 'xserver/Xi/xiselectev.c')
-rw-r--r-- | xserver/Xi/xiselectev.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/xserver/Xi/xiselectev.c b/xserver/Xi/xiselectev.c index 7aa3f0ab6..22fbaf5e7 100644 --- a/xserver/Xi/xiselectev.c +++ b/xserver/Xi/xiselectev.c @@ -42,14 +42,19 @@ * * @return BadValue if at least one invalid bit is set or Success otherwise. */ -int XICheckInvalidMaskBits(unsigned char *mask, int len) +int XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len) { if (len >= XIMaskLen(XI2LASTEVENT)) { int i; for (i = XI2LASTEVENT + 1; i < len * 8; i++) + { if (BitIsOn(mask, i)) + { + client->errorValue = i; return BadValue; + } + } } return Success; @@ -126,7 +131,10 @@ ProcXISelectEvents(ClientPtr client) { unsigned char *bits = (unsigned char*)&evmask[1]; if (BitIsOn(bits, XI_HierarchyChanged)) + { + client->errorValue = XI_HierarchyChanged; return BadValue; + } } /* Raw events may only be selected on root windows */ @@ -138,10 +146,13 @@ ProcXISelectEvents(ClientPtr client) BitIsOn(bits, XI_RawButtonPress) || BitIsOn(bits, XI_RawButtonRelease) || BitIsOn(bits, XI_RawMotion)) + { + client->errorValue = XI_RawKeyPress; return BadValue; + } } - if (XICheckInvalidMaskBits((unsigned char*)&evmask[1], + if (XICheckInvalidMaskBits(client, (unsigned char*)&evmask[1], evmask->mask_len * 4) != Success) return BadValue; |