summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-06-18 19:48:14 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-18 19:48:14 +0100
commitd6211a52ab9f53b82f884561ed43d2fe4d24ff7d (patch)
tree64d7530d2eb4daa685ad5451ee9d2c47787466a9 /src/ex_docmd.c
parent09f68a5e7817cbb40854ee6b8ae3db21d5365346 (diff)
patch 8.2.5126: substitute may overrun destination bufferv8.2.5126
Problem: Substitute may overrun destination buffer. Solution: Disallow switching buffers in a substitute expression.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index fed9330b52..1185cd1550 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -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;