diff options
author | ckelsel <ckelsel@hotmail.com> | 2017-09-24 10:05:53 +0800 |
---|---|---|
committer | ckelsel <ckelsel@hotmail.com> | 2017-09-24 10:17:14 +0800 |
commit | 2b53a565b991fc329ab7af683ec50e9cfcac557f (patch) | |
tree | b7c505d7fd20d32727c6c13e7d410935460f546e /src | |
parent | 4bb0e95abbf0a61d383d5261019a2667706c9d39 (diff) | |
download | rneovim-2b53a565b991fc329ab7af683ec50e9cfcac557f.tar.gz rneovim-2b53a565b991fc329ab7af683ec50e9cfcac557f.tar.bz2 rneovim-2b53a565b991fc329ab7af683ec50e9cfcac557f.zip |
vim-patch:8.0.0333
Problem: Illegal memory access when 'complete' ends in a backslash.
Solution: Check for trailing backslash. (Dominique Pelle, closes vim/vim#1478)
https://github.com/vim/vim/commit/226c53429109f24e31c17016aedfd7fbf7a9aa50
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/option.c | 7 | ||||
-rw-r--r-- | src/nvim/testdir/test_options.vim | 10 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 74250e83e6..13aadb71bb 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2997,9 +2997,10 @@ did_set_string_option ( if (s[-1] == 'k' || s[-1] == 's') { /* skip optional filename after 'k' and 's' */ while (*s && *s != ',' && *s != ' ') { - if (*s == '\\') - ++s; - ++s; + if (*s == '\\' && s[1] != NUL) { + s++; + } + s++; } } else { if (errbuf != NULL) { diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 2ffe63787b..8a9d793a2e 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -103,3 +103,13 @@ func Test_keymap_valid() call assert_fails(":set kmp=trunc\x00name", "E544:") call assert_fails(":set kmp=trunc\x00name", "trunc") endfunc + +func Test_complete() + " Trailing single backslash used to cause invalid memory access. + set complete=s\ + new + call feedkeys("i\<C-N>\<Esc>", 'xt') + bwipe! + set complete& +endfun + diff --git a/src/nvim/version.c b/src/nvim/version.c index d4f9c0232f..7470b07655 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -619,7 +619,7 @@ static const int included_patches[] = { // 336, // 335, // 334, - // 333, + 333, // 332, 331, // 330, |