Patch 8.2.4647

8 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 29, 2022, 2:52:46 PM3/29/22
to vim...@googlegroups.com

Patch 8.2.4647
Problem: "source" can read past end of copied line.
Solution: Add a terminating NUL.
Files: src/scriptfile.c, src/testdir/test_source.vim


*** ../vim-8.2.4646/src/scriptfile.c 2022-03-24 11:22:07.215294108 +0000
--- src/scriptfile.c 2022-03-29 19:51:02.259704070 +0100
***************
*** 1918,1924 ****
--- 1918,1927 ----
break; // all the lines are processed
ga_concat(&ga, ((char_u **)sp->buflines.ga_data)[sp->buf_lnum]);
sp->buf_lnum++;
+ if (ga_grow(&ga, 1) == FAIL)
+ break;
buf = (char_u *)ga.ga_data;
+ buf[ga.ga_len++] = NUL;
}
else
{
*** ../vim-8.2.4646/src/testdir/test_source.vim 2022-03-27 13:36:47.110991835 +0100
--- src/testdir/test_source.vim 2022-03-29 19:49:31.779777560 +0100
***************
*** 646,649 ****
--- 646,658 ----
%bw!
endfunc

+ func Test_source_buffer_long_line()
+ " This was reading past the end of the line.
+ new
+ norm300gr0
+ so
+ bwipe!
+ endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4646/src/version.c 2022-03-29 13:24:49.199974887 +0100
--- src/version.c 2022-03-29 19:47:37.391879820 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4647,
/**/

--
Proofread carefully to see if you any words out.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages