fix(api): fix nvim_cmd crash with filename expansion (#20397)

This commit is contained in:
zeertzjq
2022-09-29 16:04:14 +08:00
committed by GitHub
parent 1cf44d6f57
commit 45707c1eae
3 changed files with 21 additions and 9 deletions

View File

@@ -3887,7 +3887,7 @@ static char *repl_cmdline(exarg_T *eap, char *src, size_t srclen, char *repl, ch
} else {
// Otherwise, argument gets shifted alongside the replaced text.
// The amount of the shift is equal to the difference of the old and new string length.
eap->args[j] = new_cmdline + (eap->args[j] - *cmdlinep) + (len - srclen);
eap->args[j] = new_cmdline + ((eap->args[j] - *cmdlinep) + (ptrdiff_t)(len - srclen));
}
}