diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-23 00:52:13 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-23 00:59:11 -0400 |
commit | bcc174e6df50c87808dae0430fa4b95659678058 (patch) | |
tree | a6b21f0b6a9edd9722914aaece96033d2fe8ff96 /src | |
parent | fe191d95a2b91035369b434edc3ec6559ba3160d (diff) | |
download | rneovim-bcc174e6df50c87808dae0430fa4b95659678058.tar.gz rneovim-bcc174e6df50c87808dae0430fa4b95659678058.tar.bz2 rneovim-bcc174e6df50c87808dae0430fa4b95659678058.zip |
vim-patch:8.0.0370: invalid memory access when setting wildchar empty
Problem: Invalid memory access when setting wildchar empty.
Solution: Avoid going over the end of the option value. (Dominique Pelle,
closes vim/vim#1509) Make option test check all number options with
empty value.
https://github.com/vim/vim/commit/a12e40351d1357687e8b5dc3122fffef705bdc08
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/option.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_options.vim | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index e354d90c41..7cda42ef20 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1434,7 +1434,7 @@ do_set ( || (long *)varp == &p_wcm) && (*arg == '<' || *arg == '^' - || ((!arg[1] || ascii_iswhite(arg[1])) + || (*arg != NUL && (!arg[1] || ascii_iswhite(arg[1])) && !ascii_isdigit(*arg)))) { value = string_to_key(arg); if (value == 0 && (long *)varp != &p_wcm) { diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index ea5c39b4f4..66acb79206 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -29,6 +29,19 @@ function! Test_isfname() set isfname& endfunction +function Test_wildchar() + " Empty 'wildchar' used to access invalid memory. + call assert_fails('set wildchar=', 'E521:') + call assert_fails('set wildchar=abc', 'E521:') + set wildchar=<Esc> + let a=execute('set wildchar?') + call assert_equal("\n wildchar=<Esc>", a) + set wildchar=27 + let a=execute('set wildchar?') + call assert_equal("\n wildchar=<Esc>", a) + set wildchar& +endfunction + function! Test_options() let caught = 'ok' try |