0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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 #714)
This commit is contained in:
Bram Moolenaar
2016-03-25 18:42:46 +01:00
parent da64ab322a
commit 52c6eaffd4
3 changed files with 12 additions and 2 deletions

View File

@@ -26439,8 +26439,10 @@ repeat:
{
/* vim_strsave_shellescape() needs a NUL terminated string. */
c = (*fnamep)[*fnamelen];
if (c != NUL)
(*fnamep)[*fnamelen] = NUL;
p = vim_strsave_shellescape(*fnamep, FALSE, FALSE);
if (c != NUL)
(*fnamep)[*fnamelen] = c;
if (p == NULL)
return -1;

View File

@@ -41,3 +41,9 @@ func Test_fnamemodify()
call assert_equal("'abc\\\ndef'", fnamemodify("abc\ndef", ':S'))
set shell&
endfunc
func Test_expand()
new
call assert_equal("", expand('%:S'))
quit
endfunc

View File

@@ -748,6 +748,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1654,
/**/
1653,
/**/