From: Michael Stapelberg Date: Tue, 9 Oct 2012 12:05:37 +0000 (+0200) Subject: error out instead of accepting invalid key bindings (Thanks SardemFF7) X-Git-Tag: 4.4~62 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=80492c8304757d8d5375b8cf1c7fef6db6f32df2;p=i3%2Fi3 error out instead of accepting invalid key bindings (Thanks SardemFF7) --- 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);