From ec913fdfdeeeacb04ed0c23584e3598f1817eca3 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 9 Oct 2012 18:44:32 +0100 Subject: [PATCH] evdev-touchpad: Iterate over the touchpad spec table correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original code would overrun since the calculation of the range did not take into consideration the size of the entries in the table. Cc:Jonas Ã…dahl Signed-off-by: Rob Bradford --- src/evdev-touchpad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c index 4da37a51..8827b8b4 100644 --- a/src/evdev-touchpad.c +++ b/src/evdev-touchpad.c @@ -134,7 +134,7 @@ get_touchpad_model(struct evdev_device *device) if (ioctl(device->fd, EVIOCGID, &id) < 0) return TOUCHPAD_MODEL_UNKNOWN; - for (i = 0; i < sizeof touchpad_spec_table; i++) + for (i = 0; ARRAY_LENGTH(touchpad_spec_table); i++) if (touchpad_spec_table[i].vendor == id.vendor && (!touchpad_spec_table[i].product || touchpad_spec_table[i].product == id.product))