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.
master
Benno Schulenberg 2020-08-15 11:15:44 +02:00
parent 306906a8a7
commit 3cb55c8b27
1 changed files with 1 additions and 1 deletions

View File

@ -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. */ * an escape sequence, and return the resulting number of bytes in count. */
char *get_verbatim_kbinput(WINDOW *win, size_t *count) char *get_verbatim_kbinput(WINDOW *win, size_t *count)
{ {
char *bytes = charalloc(MAXCHARLEN + 1); char *bytes = charalloc(MAXCHARLEN + 2);
int *input; int *input;
/* Turn off flow control characters if necessary so that we can type /* Turn off flow control characters if necessary so that we can type