From 61b2f1976cec698696f6a2fe9b2f2c89e72571de Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 11 May 2017 05:22:00 +1000 Subject: [PATCH] udev: don't allow pointing stick sensitivities greater than 255 (#5927) It gets truncated, so the result is that people mess with the const accel because the sensitivity isn't the expected 300 but the too-low 45. One example: https://bugs.freedesktop.org/show_bug.cgi?id=100965 --- src/udev/udev-builtin-keyboard.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c index 07a2f94197..55f44daf59 100644 --- a/src/udev/udev-builtin-keyboard.c +++ b/src/udev/udev-builtin-keyboard.c @@ -173,6 +173,9 @@ static void set_trackpoint_sensitivity(struct udev_device *dev, const char *valu if (r < 0) { log_error("Unable to parse POINTINGSTICK_SENSITIVITY '%s' for '%s'", value, udev_device_get_devnode(dev)); return; + } else if (val_i < 0 || val_i > 255) { + log_error("POINTINGSTICK_SENSITIVITY %d outside range [0..255] for '%s' ", val_i, udev_device_get_devnode(dev)); + return; } xsprintf(val_s, "%d", val_i); -- 2.25.1