diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-02-17 14:53:15 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-02-17 14:53:15 +0100 |
commit | 226c53429109f24e31c17016aedfd7fbf7a9aa50 (patch) | |
tree | aa3b07baffa6957250161ba206e8b5f796fe3c06 | |
parent | 4e9dbc74df24dc22d0eeda3741c3fb0e0e7373bf (diff) | |
download | vim-git-226c53429109f24e31c17016aedfd7fbf7a9aa50.tar.gz |
patch 8.0.0333: illegal memory access when 'complete' ends in a backslashv8.0.0333
Problem: Illegal memory access when 'complete' ends in a backslash.
Solution: Check for trailing backslash. (Dominique Pelle, closes #1478)
-rw-r--r-- | src/option.c | 2 | ||||
-rw-r--r-- | src/testdir/test_options.vim | 9 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/option.c b/src/option.c index 32e97c99b..b5f3a9a86 100644 --- a/src/option.c +++ b/src/option.c @@ -7017,7 +7017,7 @@ did_set_string_option( /* skip optional filename after 'k' and 's' */ while (*s && *s != ',' && *s != ' ') { - if (*s == '\\') + if (*s == '\\' && s[1] != NUL) ++s; ++s; } diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim index ce59ae11b..31a87af70 100644 --- a/src/testdir/test_options.vim +++ b/src/testdir/test_options.vim @@ -136,6 +136,15 @@ func Test_thesaurus() call Check_dir_option('thesaurus') endfun +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 + func Test_set_completion() call feedkeys(":set di\<C-A>\<C-B>\"\<CR>", 'tx') call assert_equal('"set dictionary diff diffexpr diffopt digraph directory display', @:) diff --git a/src/version.c b/src/version.c index 9bbdf2ec5..dab99c76d 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 333, +/**/ 332, /**/ 331, |