summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/scriptfile.c3
-rw-r--r--src/testdir/test_source.vim9
-rw-r--r--src/version.c2
3 files changed, 14 insertions, 0 deletions
diff --git a/src/scriptfile.c b/src/scriptfile.c
index a334b2f9fc..39936a4265 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -1918,7 +1918,10 @@ get_one_sourceline(source_cookie_T *sp)
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
{
diff --git a/src/testdir/test_source.vim b/src/testdir/test_source.vim
index 35d1453747..5f45ab413c 100644
--- a/src/testdir/test_source.vim
+++ b/src/testdir/test_source.vim
@@ -646,4 +646,13 @@ func Test_source_buffer_vim9()
%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
diff --git a/src/version.c b/src/version.c
index 14fd1c369c..b18de4c5e5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4647,
+/**/
4646,
/**/
4645,