vim-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 vim/vim#3444)
e961cba3cb
This commit is contained in:
Jan Edmund Lazo 2019-05-05 09:50:34 -04:00
parent 8a9c9a9963
commit cbda383efe
2 changed files with 8 additions and 1 deletions

View File

@ -452,3 +452,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

@ -2063,7 +2063,7 @@ void 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) {
msg_putchar('\n');