]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1641 v7.4.1641
authorBram Moolenaar <Bram@vim.org>
Wed, 23 Mar 2016 21:28:25 +0000 (22:28 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 23 Mar 2016 21:28:25 +0000 (22:28 +0100)
Problem:    Using unterminated string.
Solution:   Add NUL before calling vim_strsave_shellescape(). (James McCoy)

src/eval.c
src/testdir/test105.in
src/testdir/test105.ok
src/version.c

index 990fa8c05bda98ae092c7070a43a8443279a2ec0..9091f7972fb0b7e2a340a0c4795c05e647ae9a1e 100644 (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;
index 58c4f84c0d0a4dec7d1163ede38e836a60c3a6e5..9921d7ed7c477bd9bedd98c7dd084a831a00cfc1 100644 (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'
index 5f1de5f9e637bcacfc9026798b55ebffa47ffe22..584f0fe6a02acfe73ed402c14257aaecc736adca 100644 (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
index c9c550a490b9f101ef16e775f8a9859134399c68..465794a0aa69535a0865475fe8588595977a0b85 100644 (file)
@@ -748,6 +748,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1641,
 /**/
     1640,
 /**/