diff options
author | James McCoy <jamessan@jamessan.com> | 2016-03-28 09:47:46 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2016-03-30 08:30:35 -0400 |
commit | 7558f42f7d9900d37a1915ce78f1102ee251d420 (patch) | |
tree | 42b54298c1c2638a8c8c80d18a7a6c5210f8d9b7 /src/nvim/eval.c | |
parent | 62c0d99474eb0dffcd36d227057755c16c8a9570 (diff) | |
download | rneovim-7558f42f7d9900d37a1915ce78f1102ee251d420.tar.gz rneovim-7558f42f7d9900d37a1915ce78f1102ee251d420.tar.bz2 rneovim-7558f42f7d9900d37a1915ce78f1102ee251d420.zip |
vim-patch:7.4.1654
Problem: Crash when using expand('%:S') in a buffer without a name.
Solution: Don't set a NUL. (James McCoy, closes vim/vim#714)
https://github.com/vim/vim/commit/52c6eaffd43a8c8865f8d6ed7cde0a8b137479e2
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index fbde845f47..3c67625d1c 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -21995,9 +21995,13 @@ repeat: if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S') { // vim_strsave_shellescape() needs a NUL terminated string. c = (*fnamep)[*fnamelen]; - (*fnamep)[*fnamelen] = NUL; + if (c != NUL) { + (*fnamep)[*fnamelen] = NUL; + } p = vim_strsave_shellescape(*fnamep, false, false); - (*fnamep)[*fnamelen] = c; + if (c != NUL) { + (*fnamep)[*fnamelen] = c; + } xfree(*bufp); *bufp = *fnamep = p; *fnamelen = STRLEN(p); |