0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.4647: "source" can read past end of copied line

Problem:    "source" can read past end of copied line.
Solution:   Add a terminating NUL.
This commit is contained in:
Bram Moolenaar
2022-03-29 19:52:12 +01:00
parent b55986c52d
commit 2bdad61267
3 changed files with 14 additions and 0 deletions

View File

@@ -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
{