From 886c8e299454176446cce82f151b85a82b26aa06 Mon Sep 17 00:00:00 2001 From: cbdev Date: Wed, 18 Dec 2019 22:23:34 +0100 Subject: Fix evdev division by zero --- backends/evdev.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'backends/evdev.c') diff --git a/backends/evdev.c b/backends/evdev.c index 659dc77..193b28b 100644 --- a/backends/evdev.c +++ b/backends/evdev.c @@ -208,6 +208,9 @@ static int evdev_configure_instance(instance* inst, char* option, char* value) { data->relative_axis[data->relative_axes].max *= -1; data->relative_axis[data->relative_axes].inverted = 1; } + else if(data->relative_axis[data->relative_axes].max == 0){ + fprintf(stderr, "Relative axis configuration for %s.%s has invalid range\n", inst->name, option + 8); + } data->relative_axis[data->relative_axes].current = strtoul(next_token, NULL, 0); if(data->relative_axis[data->relative_axes].code < 0){ fprintf(stderr, "Failed to configure relative axis extents for %s.%s\n", inst->name, option + 8); -- cgit v1.2.3