aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-12-18 19:39:08 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-12-18 19:39:08 +0000
commitc076f03dc49335a72e78c3b8a31f58edba1e5857 (patch)
tree78df9afa6db7f2821c8989bb6f0277aad3702047
parentMerge branch 'shm-buffer-busy-sometimes-not-set' (diff)
config: error out on empty key- or mouse binding
Closes #851
-rw-r--r--CHANGELOG.md2
-rw-r--r--config.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1904fd5d..9a972955 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -62,6 +62,8 @@
CSI codes in the Kitty keyboard protocol.
* Assertion in `shm.c:buffer_release()`
(https://codeberg.org/dnkl/foot/issues/844).
+* Crash when setting a key- or mouse binding to the empty string
+ (https://codeberg.org/dnkl/foot/issues/851).
### Security
diff --git a/config.c b/config.c
index 50fb74e6..2b7ad378 100644
--- a/config.c
+++ b/config.c
@@ -1726,6 +1726,12 @@ value_to_key_combos(struct context *ctx, int action, struct argv *argv,
}
+ if (idx == 0) {
+ LOG_CONTEXTUAL_ERR(
+ "empty binding not allowed (set to 'none' to unmap)");
+ goto err;
+ }
+
remove_from_key_bindings_list(bindings, action, argv);
bindings->arr = xrealloc(