0
0
mirror of https://github.com/vim/vim.git synced 2025-07-24 10:45:12 -04:00

patch 8.1.0404: accessing invalid memory with long argument name

Problem:    Accessing invalid memory with long argument name.
Solution:   Use item_count instead of checking for a terminating NULL.
            (Dominique Pelle, closes #3444)
This commit is contained in:
Bram Moolenaar 2018-09-18 21:51:47 +02:00
parent cc3a997746
commit e961cba3cb
2 changed files with 10 additions and 1 deletions

View File

@ -411,3 +411,10 @@ func Test_arg_all_expand()
call assert_equal('notexist Xx\ x runtest.vim', expand('##'))
call delete('Xx x')
endfunc
func Test_large_arg()
" Argument longer or equal to the number of columns used to cause
" access to invalid memory.
exe 'argadd ' .repeat('x', &columns)
args
endfunc

View File

@ -794,6 +794,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
404,
/**/
403,
/**/
@ -1725,7 +1727,7 @@ list_in_columns(char_u **items, int size, int current)
if (Columns < width)
{
/* Not enough screen columns - show one per line */
for (i = 0; items[i] != NULL; ++i)
for (i = 0; i < item_count; ++i)
{
version_msg_wrap(items[i], i == current);
if (msg_col > 0)