tablet: check the button range before we use it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
This commit is contained in:
Peter Hutterer 2014-06-17 14:10:46 +10:00
parent 413d6ccfc7
commit f86c89c5c8

View file

@ -167,6 +167,8 @@ tablet_update_button(struct tablet_dispatch *tablet,
return;
}
assert(button < 32);
if (enable) {
(*flags) |= 1 << button;
tablet_set_status(tablet, TABLET_BUTTONS_PRESSED);
@ -174,8 +176,6 @@ tablet_update_button(struct tablet_dispatch *tablet,
(*flags) &= ~(1 << button);
tablet_set_status(tablet, TABLET_BUTTONS_RELEASED);
}
assert(button < 32);
}
static void