From 904a7a4abd511426e2430fdd016fca22e84583c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 15 Dec 2016 11:52:14 +0100 Subject: 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 --- vis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vis.c') 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 */ - 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; -- cgit v1.2.3