[PATCH evemu 1/2] Fail when reading an EV_foo index greater than EV_MAX

Peter Hutterer peter.hutterer at who-t.net
Thu Oct 20 23:12:33 UTC 2016


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evemu.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/evemu.c b/src/evemu.c
index 49302fd..b3a0c1a 100644
--- a/src/evemu.c
+++ b/src/evemu.c
@@ -537,6 +537,11 @@ static int parse_mask(struct evemu_device *dev, const char *line)
 		return -1;
 	}
 
+	if (index >= EV_CNT) {
+		error(FATAL, "Invalid EV_* index %#x in line: %s", index, line);
+		return -1;
+	}
+
 	for (i = 0; i < sizeof(mask) * 8; i++) {
 		if (bit_is_set(mask, i)) {
 			struct input_absinfo abs = {0}; /* dummy */
-- 
2.9.3



More information about the Input-tools mailing list