From 3cb55c8b277875e4e33250b414d3deb5c2dc421e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 15 Aug 2020 11:15:44 +0200 Subject: [PATCH] verbatim: reserve enough space for the result also in non-UTF-8 locales Also when each character is just one byte, parse_verbatim_kbinput() can produce two bytes; plus the terminating NUL that is three bytes. This fixes https://savannah.gnu.org/bugs/?58959. Bug existed since version 4.9, commit 03d296eb. --- src/winio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/winio.c b/src/winio.c index 1d4c44f5..78c0a7e2 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1449,7 +1449,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count) * an escape sequence, and return the resulting number of bytes in count. */ char *get_verbatim_kbinput(WINDOW *win, size_t *count) { - char *bytes = charalloc(MAXCHARLEN + 1); + char *bytes = charalloc(MAXCHARLEN + 2); int *input; /* Turn off flow control characters if necessary so that we can type