aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/command.c
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2025-08-13 04:43:56 +0800
committerGitHub <noreply@github.com>2025-08-12 13:43:56 -0700
commitc7c3f9fc9c3a97cc8f48ea5cfffa1d0fc79abb5d (patch)
tree617e34508e03f32263276cd263aeaba1195dedc6 /src/nvim/api/command.c
parent3eab5bd38a5680066166a4e94c788ef345081dc7 (diff)
downloadrneovim-c7c3f9fc9c3a97cc8f48ea5cfffa1d0fc79abb5d.tar.gz
rneovim-c7c3f9fc9c3a97cc8f48ea5cfffa1d0fc79abb5d.tar.bz2
rneovim-c7c3f9fc9c3a97cc8f48ea5cfffa1d0fc79abb5d.zip
fix(api): fix crash in command preview with % #35228
Problem: parse_cmdline() sets eap->cmdlinep to address of local parameter, causing invalid memory access when expand_filename() tries to modify it. This leads to crashes when typing '%' in user commands with preview=true and complete=file. Solution: Change parse_cmdline() signature to accept char **cmdline, allowing cmdlinep to point to caller's variable for safe reallocation.
Diffstat (limited to 'src/nvim/api/command.c')
-rw-r--r--src/nvim/api/command.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c
index 325de4c53d..4b334d3e3b 100644
--- a/src/nvim/api/command.c
+++ b/src/nvim/api/command.c
@@ -134,7 +134,7 @@ Dict(cmd) nvim_parse_cmd(String str, Dict(empty) *opts, Arena *arena, Error *err
char *cmdline = arena_memdupz(arena, str.data, str.size);
const char *errormsg = NULL;
- if (!parse_cmdline(cmdline, &ea, &cmdinfo, &errormsg)) {
+ if (!parse_cmdline(&cmdline, &ea, &cmdinfo, &errormsg)) {
if (errormsg != NULL) {
api_set_error(err, kErrorTypeException, "Parsing command-line: %s", errormsg);
} else {