diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-05-24 05:57:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-24 05:57:00 +0800 |
commit | e7859d2ad504a3e3cae1d540d5fd4f9b560d154a (patch) | |
tree | dce2699ec3634cf3e542d0d2605a25e43d1ede3a /src/nvim/regexp.c | |
parent | 0d3d198109ff971c1537dc5361437d0397dba7af (diff) | |
download | rneovim-e7859d2ad504a3e3cae1d540d5fd4f9b560d154a.tar.gz rneovim-e7859d2ad504a3e3cae1d540d5fd4f9b560d154a.tar.bz2 rneovim-e7859d2ad504a3e3cae1d540d5fd4f9b560d154a.zip |
vim-patch:9.1.0436: Crash when using '?' as separator for :s (#28955)
Problem: Crash when using '?' as separator for :s and pattern contains
escaped '?'s (after 9.1.0409).
Solution: Always compute startplen. (zeertzjq).
related: neovim/neovim#28935
closes: 14832
https://github.com/vim/vim/commit/789679cfc4f39505b135220672b43a260d8ca3b4
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 1027ce05b6..fa6e577c74 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -774,6 +774,7 @@ char *skip_regexp_ex(char *startp, int dirc, int magic, char **newp, int *droppe { magic_T mymagic; char *p = startp; + size_t startplen = strlen(startp); if (magic) { mymagic = MAGIC_ON; @@ -793,11 +794,9 @@ char *skip_regexp_ex(char *startp, int dirc, int magic, char **newp, int *droppe break; } } else if (p[0] == '\\' && p[1] != NUL) { - size_t startplen = 0; if (dirc == '?' && newp != NULL && p[1] == '?') { // change "\?" to "?", make a copy first. if (*newp == NULL) { - startplen = strlen(startp); *newp = xstrnsave(startp, startplen); p = *newp + (p - startp); } |