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:
@@ -3441,9 +3441,17 @@ theend:
|
|||||||
static void
|
static void
|
||||||
append_command(char_u *cmd)
|
append_command(char_u *cmd)
|
||||||
{
|
{
|
||||||
|
size_t len = STRLEN(IObuff);
|
||||||
char_u *s = cmd;
|
char_u *s = cmd;
|
||||||
char_u *d;
|
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, ": ");
|
STRCAT(IObuff, ": ");
|
||||||
d = IObuff + STRLEN(IObuff);
|
d = IObuff + STRLEN(IObuff);
|
||||||
while (*s != NUL && d - IObuff + 5 < IOSIZE)
|
while (*s != NUL && d - IObuff + 5 < IOSIZE)
|
||||||
|
@@ -3413,4 +3413,9 @@ func Test_recursive_register()
|
|||||||
call assert_equal('yes', caught)
|
call assert_equal('yes', caught)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_long_error_message()
|
||||||
|
" the error should be truncated, not overrun IObuff
|
||||||
|
silent! norm Q00000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -734,6 +734,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
5063,
|
||||||
/**/
|
/**/
|
||||||
5062,
|
5062,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user