diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-24 19:54:02 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2025-02-28 18:21:08 +0800 |
commit | b66f395ff444643852e3539b849267658e885bf4 (patch) | |
tree | fce024d2f065017d40f1536fa4d948676da54a76 /src | |
parent | 4e25b1a675976ed238752d547dc05aaaef38af29 (diff) | |
download | rneovim-b66f395ff444643852e3539b849267658e885bf4.tar.gz rneovim-b66f395ff444643852e3539b849267658e885bf4.tar.bz2 rneovim-b66f395ff444643852e3539b849267658e885bf4.zip |
vim-patch:8.2.4974: ":so" command may read after end of buffer
Problem: ":so" command may read after end of buffer.
Solution: Compute length of text properly.
https://github.com/vim/vim/commit/4748c4bd64610cf943a431d215bb1aad51f8d0b4
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/runtime.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 85af98f9ce..86ca4f08dc 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -2726,6 +2726,7 @@ static char *get_one_sourceline(source_cookie_T *sp) ga_grow(&ga, 1); buf = (char *)ga.ga_data; buf[ga.ga_len++] = NUL; + len = ga.ga_len; } else { buf = ga.ga_data; retry: @@ -2736,8 +2737,8 @@ retry: } break; } + len = ga.ga_len + (int)strlen(buf + ga.ga_len); } - len = ga.ga_len + (int)strlen(buf + ga.ga_len); #ifdef USE_CRNL // Ignore a trailing CTRL-Z, when in Dos mode. Only recognize the // CTRL-Z by its own, or after a NL. |