Fix a crash when requesting invalid mode group indices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2017-02-24 10:10:44 +10:00
parent 67a7026b74
commit c787ccf270

View file

@ -645,5 +645,9 @@ evdev_device_tablet_pad_get_mode_group(struct evdev_device *device,
if (!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD))
return NULL;
if (index >=
(unsigned int)evdev_device_tablet_pad_get_num_mode_groups(device))
return NULL;
return pad_get_mode_group(pad, index);
}