diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-06-06 15:38:21 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-06-06 15:38:21 +0100 |
commit | 44a3f3353e0407e9fffee138125a6927d1c9e7e5 (patch) | |
tree | 2f8eab55877ffb8d6b51d8be01aaeeccf71db6e9 /src/ex_docmd.c | |
parent | 1f89abf69d2c485c38da9a45161e806de0f86f2f (diff) |
patch 8.2.5063: error for a command may go over the end of IObuffv8.2.5063
Problem: Error for a command may go over the end of IObuff.
Solution: Truncate the message.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index cfb40e8d5c..634a1bcef5 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -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) |