summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-11-12 17:41:51 +0100
committerWim Taymans <wtaymans@redhat.com>2019-11-12 17:41:51 +0100
commite32e1d014e1774a052edca4916f6efbc1fbcff32 (patch)
tree1b9a0035e3eb7417f432acba806b42693ff18df7
parentd8b1878c9b85cee8b8ebcf99db9e9e1aa4461638 (diff)
SDL_evdev: make sure we don't overrun our slots arrayfixes
Make sure we clamp current_slot to max_slots so that we never overrun our slots array.
-rw-r--r--src/core/linux/SDL_evdev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c
index b33a8fdf20..10293cf444 100644
--- a/src/core/linux/SDL_evdev.c
+++ b/src/core/linux/SDL_evdev.c
@@ -307,7 +307,8 @@ SDL_EVDEV_Poll(void)
case ABS_MT_SLOT:
if (!item->is_touchscreen) /* FIXME: temp hack */
break;
- item->touchscreen_data->current_slot = events[i].value;
+ if (events[i].value < item->touchscreen_data->max_slots)
+ item->touchscreen_data->current_slot = events[i].value;
break;
case ABS_MT_TRACKING_ID:
if (!item->is_touchscreen) /* FIXME: temp hack */