summaryrefslogtreecommitdiff
path: root/Xi/xipassivegrab.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-09-01 16:33:56 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-09-03 08:39:27 +1000
commit727de7c90de4198222e0dc58d7503b4a1672f642 (patch)
tree94dd12c394b687ede6b6b7dbc41350ee3fd2eeee /Xi/xipassivegrab.c
parent59a6d7d478903a8bc9c5d4cc8b2e62e2ad102dba (diff)
Xi: Unify checking for invalid bits in grab masks.
Bits above XI2LASTEVENT are invalid and cause in BadValues. These checks must be performed anywhere where a mask_len parameter is given. This patch also adds the missing checks to grab masks. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi/xipassivegrab.c')
-rw-r--r--Xi/xipassivegrab.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 0cfdc1d9b..41a56b14e 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -118,15 +118,9 @@ ProcXIPassiveGrabDevice(ClientPtr client)
return BadValue;
}
- if ((stuff->mask_len * 4) > XI2LASTEVENT)
- {
- unsigned char *bits = (unsigned char*)&stuff[1];
- for (i = XI2LASTEVENT; i < stuff->mask_len * 4; i++)
- {
- if (BitIsOn(bits, i))
- return BadValue;
- }
- }
+ if (XICheckInvalidMaskBits((unsigned char*)&stuff[1],
+ stuff->mask_len * 4) != Success)
+ return BadValue;
mask_len = min(sizeof(mask.xi2mask[stuff->deviceid]), stuff->mask_len * 4);
memset(mask.xi2mask, 0, sizeof(mask.xi2mask));