summaryrefslogtreecommitdiff
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-07-02 13:43:21 +0100
committerBram Moolenaar <Bram@vim.org>2022-07-02 13:43:21 +0100
commitc6fdb15d423df22e1776844811d082322475e48a (patch)
treedef7bf00a0c576aae589520523797dbc06c3675d /src/ex_docmd.c
parentaf043e12d9e5869c597de40b9a2517ae97ac72e7 (diff)
downloadvim-git-c6fdb15d423df22e1776844811d082322475e48a.tar.gz
patch 9.0.0025: accessing beyond allocated memory with the cmdline windowv9.0.0025
Problem: Accessing beyond allocated memory when using the cmdline window in Ex mode. Solution: Use "*" instead of "'<,'>" for Visual mode.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 271e7e246..697337cad 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3118,9 +3118,11 @@ parse_command_modifiers(
size_t len = STRLEN(cmd_start);
// Special case: empty command uses "+":
- // "'<,'>mods" -> "mods'<,'>+
+ // "'<,'>mods" -> "mods *+
+ // Use "*" instead of "'<,'>" to avoid the command getting
+ // longer, in case is was allocated.
mch_memmove(orig_cmd, cmd_start, len);
- STRCPY(orig_cmd + len, "'<,'>+");
+ STRCPY(orig_cmd + len, " *+");
}
else
{