vim-patch:7.4.1641

Problem:    Using unterminated string.
Solution:   Add NUL before calling vim_strsave_shellescape(). (James McCoy)

5ca84ce4aa
This commit is contained in:
James McCoy
2016-03-25 14:17:10 -04:00
parent a9e0d734d7
commit 5f0c76b243
3 changed files with 5 additions and 0 deletions

View File

@@ -21993,6 +21993,8 @@ repeat:
}
if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S') {
// vim_strsave_shellescape() needs a NUL terminated string.
(*fnamep)[*fnamelen] = NUL;
p = vim_strsave_shellescape(*fnamep, false, false);
xfree(*bufp);
*bufp = *fnamep = p;

View File

@@ -69,6 +69,7 @@ static char *features[] = {
// clang-format off
static int included_patches[] = {
1641,
1574,
1570,
1511,

View File

@@ -43,6 +43,7 @@ describe('filename modifiers', function()
execute([=[Put fnamemodify('abc'' ''def', ':S' )]=])
execute([=[Put fnamemodify('abc''%''def', ':S' )]=])
execute([=[Put fnamemodify("abc\ndef", ':S' )]=])
execute([=[Put expand('%:r:S') == shellescape(expand('%:r'))]=])
execute([=[set shell=tcsh]=])
execute([=[Put fnamemodify("abc\ndef", ':S' )]=])
execute([=[1 delete _]=])
@@ -76,6 +77,7 @@ describe('filename modifiers', function()
fnamemodify('abc'' ''def', ':S' ) '''abc''\'''' ''\''''def'''
fnamemodify('abc''%''def', ':S' ) '''abc''\''''%''\''''def'''
fnamemodify("abc\ndef", ':S' ) '''abc^@def'''
expand('%:r:S') == shellescape(expand('%:r')) 1
fnamemodify("abc\ndef", ':S' ) '''abc\^@def''']=])
end)
end)