Skip to content

Commit 5ca84ce

Browse files
committed
patch 7.4.1641
Problem: Using unterminated string. Solution: Add NUL before calling vim_strsave_shellescape(). (James McCoy)
1 parent ffec3c5 commit 5ca84ce

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

src/eval.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26439,6 +26439,8 @@ modify_fname(
2643926439

2644026440
if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S')
2644126441
{
26442+
/* vim_strsave_shellescape() needs a NUL terminated string. */
26443+
(*fnamep)[*fnamelen] = NUL;
2644226444
p = vim_strsave_shellescape(*fnamep, FALSE, FALSE);
2644326445
if (p == NULL)
2644426446
return -1;

src/testdir/test105.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ STARTTEST
3535
:Put fnamemodify('abc'' ''def', ':S' )
3636
:Put fnamemodify('abc''%''def', ':S' )
3737
:Put fnamemodify("abc\ndef", ':S' )
38+
:Put expand('%:r:S') == shellescape(expand('%:r'))
3839
:set shell=tcsh
3940
:Put fnamemodify("abc\ndef", ':S' )
4041
:$put ='vim: ts=8'

src/testdir/test105.ok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ fnamemodify('abc"%"def', ':S' ) '''abc"%"def'''
2525
fnamemodify('abc'' ''def', ':S' ) '''abc''\'''' ''\''''def'''
2626
fnamemodify('abc''%''def', ':S' ) '''abc''\''''%''\''''def'''
2727
fnamemodify("abc\ndef", ':S' ) '''abc^@def'''
28+
expand('%:r:S') == shellescape(expand('%:r')) 1
2829
fnamemodify("abc\ndef", ':S' ) '''abc\^@def'''
2930
vim: ts=8

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1641,
751753
/**/
752754
1640,
753755
/**/

0 commit comments

Comments
 (0)