mirror of https://github.com/neovim/neovim.git
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.
4748c4bd64
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
6063975bcf
commit
e59f31e6c5
|
@ -2628,6 +2628,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:
|
||||
|
@ -2638,8 +2639,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.
|
||||
|
|
|
@ -612,6 +612,17 @@ func Test_source_buffer_long_line()
|
|||
norm300gr0
|
||||
so
|
||||
bwipe!
|
||||
|
||||
let lines =<< trim END
|
||||
new
|
||||
norm 10a0000000000ø00000000000
|
||||
norm i0000000000000000000
|
||||
silent! so
|
||||
END
|
||||
call writefile(lines, 'Xtest.vim')
|
||||
source Xtest.vim
|
||||
bwipe!
|
||||
call delete('Xtest.vim')
|
||||
endfunc
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue