From 80492c8304757d8d5375b8cf1c7fef6db6f32df2 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 9 Oct 2012 14:05:37 +0200 Subject: [PATCH] error out instead of accepting invalid key bindings (Thanks SardemFF7) --- src/config_directives.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/config_directives.c b/src/config_directives.c index c885b256..7847376d 100644 --- a/src/config_directives.c +++ b/src/config_directives.c @@ -186,6 +186,10 @@ CFGFUN(binding, const char *bindtype, const char *modifiers, const char *key, co } else { // TODO: strtol with proper error handling new_binding->keycode = atoi(key); + if (new_binding->keycode == 0) { + ELOG("Could not parse \"%s\" as a keycode, ignoring this binding.\n", key); + return; + } } new_binding->mods = modifiers_from_str(modifiers); new_binding->command = sstrdup(command); @@ -208,6 +212,10 @@ CFGFUN(mode_binding, const char *bindtype, const char *modifiers, const char *ke } else { // TODO: strtol with proper error handling new_binding->keycode = atoi(key); + if (new_binding->keycode == 0) { + ELOG("Could not parse \"%s\" as a keycode, ignoring this binding.\n", key); + return; + } } new_binding->mods = modifiers_from_str(modifiers); new_binding->command = sstrdup(command); -- 2.39.5