From: Rob Bradford <[email protected]>

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 <[email protected]>
Signed-off-by: Rob Bradford <[email protected]>
---
 src/evdev-touchpad.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c
index 4da37a5..8228f30 100644
--- a/src/evdev-touchpad.c
+++ b/src/evdev-touchpad.c
@@ -134,7 +134,9 @@ 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;
+            i < sizeof touchpad_spec_table / sizeof touchpad_spec_table[0];
+            i++)
                if (touchpad_spec_table[i].vendor == id.vendor &&
                    (!touchpad_spec_table[i].product ||
                     touchpad_spec_table[i].product == id.product))
-- 
1.7.11.2

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to