Problem: "source" can read past end of copied line.
Solution: Add a terminating NUL.
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
{
%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
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4647,
/**/
4646,
/**/