summaryrefslogtreecommitdiffstats
path: root/src/regexp.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-05-23 17:41:26 +0200
committerChristian Brabandt <cb@256bit.org>2024-05-23 17:41:26 +0200
commit789679cfc4f39505b135220672b43a260d8ca3b4 (patch)
treee31f7adc916fabe18f381ca0a488cf7b756a991f /src/regexp.c
parentcd79f8fbd34cdb918153d9fa3821eb4092b7b5fc (diff)
patch 9.1.0436: Crash when using '?' as separator for :sv9.1.0436
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 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/regexp.c b/src/regexp.c
index d431932191..147452aae2 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -620,6 +620,7 @@ skip_regexp_ex(
{
magic_T mymagic;
char_u *p = startp;
+ size_t startplen = STRLEN(startp);
if (magic)
mymagic = MAGIC_ON;
@@ -642,12 +643,9 @@ skip_regexp_ex(
{
if (dirc == '?' && newp != NULL && p[1] == '?')
{
- size_t startplen = 0;
-
// change "\?" to "?", make a copy first.
if (*newp == NULL)
{
- startplen = STRLEN(startp);
*newp = vim_strnsave(startp, startplen);
if (*newp != NULL)
p = *newp + (p - startp);