forked from aniani/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 #714)
This commit is contained in:
@@ -26439,9 +26439,11 @@ repeat:
|
|||||||
{
|
{
|
||||||
/* vim_strsave_shellescape() needs a NUL terminated string. */
|
/* vim_strsave_shellescape() needs a NUL terminated string. */
|
||||||
c = (*fnamep)[*fnamelen];
|
c = (*fnamep)[*fnamelen];
|
||||||
(*fnamep)[*fnamelen] = NUL;
|
if (c != NUL)
|
||||||
|
(*fnamep)[*fnamelen] = NUL;
|
||||||
p = vim_strsave_shellescape(*fnamep, FALSE, FALSE);
|
p = vim_strsave_shellescape(*fnamep, FALSE, FALSE);
|
||||||
(*fnamep)[*fnamelen] = c;
|
if (c != NUL)
|
||||||
|
(*fnamep)[*fnamelen] = c;
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
vim_free(*bufp);
|
vim_free(*bufp);
|
||||||
|
@@ -41,3 +41,9 @@ func Test_fnamemodify()
|
|||||||
call assert_equal("'abc\\\ndef'", fnamemodify("abc\ndef", ':S'))
|
call assert_equal("'abc\\\ndef'", fnamemodify("abc\ndef", ':S'))
|
||||||
set shell&
|
set shell&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_expand()
|
||||||
|
new
|
||||||
|
call assert_equal("", expand('%:S'))
|
||||||
|
quit
|
||||||
|
endfunc
|
||||||
|
@@ -748,6 +748,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1654,
|
||||||
/**/
|
/**/
|
||||||
1653,
|
1653,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user