0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

patch 7.4.1641

Problem:    Using unterminated string.
Solution:   Add NUL before calling vim_strsave_shellescape(). (James McCoy)
This commit is contained in:
Bram Moolenaar 2016-03-23 22:28:25 +01:00
parent ffec3c5349
commit 5ca84ce4aa
4 changed files with 6 additions and 0 deletions

View File

@ -26439,6 +26439,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);
if (p == NULL)
return -1;

View File

@ -35,6 +35,7 @@ STARTTEST
:Put fnamemodify('abc'' ''def', ':S' )
:Put fnamemodify('abc''%''def', ':S' )
:Put fnamemodify("abc\ndef", ':S' )
:Put expand('%:r:S') == shellescape(expand('%:r'))
:set shell=tcsh
:Put fnamemodify("abc\ndef", ':S' )
:$put ='vim: ts=8'

View File

@ -25,5 +25,6 @@ fnamemodify('abc"%"def', ':S' ) '''abc"%"def'''
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'''
vim: ts=8

View File

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