Mercurial > vim
changeset 28242:5bf82b918cb2 v8.2.4647
patch 8.2.4647: "source" can read past end of copied line
Commit: https://github.com/vim/vim/commit/2bdad6126778f907c0b98002bfebf0e611a3f5db
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Mar 29 19:52:12 2022 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 29 Mar 2022 21:00:04 +0200 |
parents | 56e2b05a232f |
children | 0e3366e35705 |
files | src/scriptfile.c src/testdir/test_source.vim src/version.c |
diffstat | 3 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 {