0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.5063: error for a command may go over the end of IObuff

Problem:    Error for a command may go over the end of IObuff.
Solution:   Truncate the message.
This commit is contained in:
Bram Moolenaar
2022-06-06 15:38:21 +01:00
parent 1f89abf69d
commit 44a3f3353e
3 changed files with 17 additions and 2 deletions

View File

@@ -3441,9 +3441,17 @@ theend:
static void
append_command(char_u *cmd)
{
char_u *s = cmd;
char_u *d;
size_t len = STRLEN(IObuff);
char_u *s = cmd;
char_u *d;
if (len > IOSIZE - 100)
{
// Not enough space, truncate and put in "...".
d = IObuff + IOSIZE - 100;
d -= mb_head_off(IObuff, d);
STRCPY(d, "...");
}
STRCAT(IObuff, ": ");
d = IObuff + STRLEN(IObuff);
while (*s != NUL && d - IObuff + 5 < IOSIZE)