To: vim_dev@googlegroups.com Subject: Patch 7.4.1641 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1641 Problem: Using unterminated string. Solution: Add NUL before calling vim_strsave_shellescape(). (James McCoy) Files: src/eval.c, src/testdir/test105.in, src/testdir/test105.ok *** ../vim-7.4.1640/src/eval.c 2016-03-22 22:33:59.214427026 +0100 --- src/eval.c 2016-03-23 22:27:48.556418198 +0100 *************** *** 26439,26444 **** --- 26439,26446 ---- 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; *** ../vim-7.4.1640/src/testdir/test105.in 2014-03-27 12:40:26.188420131 +0100 --- src/testdir/test105.in 2016-03-23 22:22:29.011832725 +0100 *************** *** 35,40 **** --- 35,41 ---- :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' *** ../vim-7.4.1640/src/testdir/test105.ok 2014-03-27 12:40:26.188420131 +0100 --- src/testdir/test105.ok 2016-03-23 22:22:29.011832725 +0100 *************** *** 25,29 **** --- 25,30 ---- 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 *** ../vim-7.4.1640/src/version.c 2016-03-23 20:55:22.823036742 +0100 --- src/version.c 2016-03-23 22:24:09.746755255 +0100 *************** *** 750,751 **** --- 750,753 ---- { /* Add new patch number below this line */ + /**/ + 1641, /**/ -- hundred-and-one symptoms of being an internet addict: 106. When told to "go to your room" you inform your parents that you can't...because you were kicked out and banned. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///