aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-12-15 11:52:14 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-12-15 12:47:13 +0100
commit904a7a4abd511426e2430fdd016fca22e84583c2 (patch)
tree588dd64b78ad651bb59f870bce0e2bde702868ab /vis.c
parentaa28462c2102e3c24fa8dc4e60436665f53862ea (diff)
downloadvis-904a7a4abd511426e2430fdd016fca22e84583c2.tar.gz
vis-904a7a4abd511426e2430fdd016fca22e84583c2.tar.xz
vis: respect terminating NUL bytes in the input queue
It can happen that the Buffer content used for the input queue becomes <\000> where the NUL byte is intended to terminate the queue, but termkey happily parses it and because it is delimited by < and > on both sides we then interpret it as a key. In input mode this leads to the insertion of a NUL byte which is displayed as ^@. Close #432
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vis.c b/vis.c
index 87bcb45..1376b1c 100644
--- a/vis.c
+++ b/vis.c
@@ -844,7 +844,7 @@ const char *vis_keys_next(Vis *vis, const char *keys) {
TermKey *termkey = vis->ui->termkey_get(vis->ui);
const char *next = NULL;
/* first try to parse a special key of the form <Key> */
- if (*keys == '<' && (next = termkey_strpkey(termkey, keys+1, &key, TERMKEY_FORMAT_VIM)) && *next == '>')
+ if (*keys == '<' && keys[1] && (next = termkey_strpkey(termkey, keys+1, &key, TERMKEY_FORMAT_VIM)) && *next == '>')
return next+1;
if (*keys == '<') {
const char *start = keys + 1, *end = start;