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

patch 8.2.5126: substitute may overrun destination buffer

Problem:    Substitute may overrun destination buffer.
Solution:   Disallow switching buffers in a substitute expression.
This commit is contained in:
Bram Moolenaar
2022-06-18 19:48:14 +01:00
parent 09f68a5e78
commit d6211a52ab
3 changed files with 19 additions and 3 deletions

View File

@@ -7138,9 +7138,10 @@ do_exedit(
#endif
)
{
// Can't edit another file when "curbuf_lock" is set. Only ":edit"
// can bring us here, others are stopped earlier.
if (*eap->arg != NUL && curbuf_locked())
// Can't edit another file when "textlock" or "curbuf_lock" is set.
// Only ":edit" or ":script" can bring us here, others are stopped
// earlier.
if (*eap->arg != NUL && text_or_buf_locked())
return;
n = readonlymode;