diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index 3efef60f8e..7d5511f587 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -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 diff --git a/src/nvim/version.c b/src/nvim/version.c index 28bd22dcb3..baa0df84f4 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -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');