mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	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)
52c6eaffd4
			
			
This commit is contained in:
		| @@ -21995,9 +21995,13 @@ repeat: | ||||
|   if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S') { | ||||
|     // 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; | ||||
|     } | ||||
|     xfree(*bufp); | ||||
|     *bufp = *fnamep = p; | ||||
|     *fnamelen = STRLEN(p); | ||||
|   | ||||
| @@ -69,6 +69,7 @@ static char *features[] = { | ||||
|  | ||||
| // clang-format off | ||||
| static int included_patches[] = { | ||||
|   1654, | ||||
|   1652, | ||||
|   1643, | ||||
|   1641, | ||||
|   | ||||
| @@ -54,6 +54,12 @@ describe('filename modifiers', function() | ||||
|         set shell=tcsh | ||||
|         call assert_equal("'abc\\\ndef'", fnamemodify("abc\ndef", ':S')) | ||||
|       endfunc | ||||
|  | ||||
|       func Test_expand() | ||||
|         new | ||||
|         call assert_equal("", expand('%:S')) | ||||
|         quit | ||||
|       endfunc | ||||
|     ]=]) | ||||
|   end) | ||||
|  | ||||
| @@ -61,4 +67,9 @@ describe('filename modifiers', function() | ||||
|     call('Test_fnamemodify') | ||||
|     expected_empty() | ||||
|   end) | ||||
|  | ||||
|   it('works for :S in an unnamed buffer', function() | ||||
|     call('Test_expand') | ||||
|     expected_empty() | ||||
|   end) | ||||
| end) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 James McCoy
					James McCoy