From 11343d89efcb027b4a8855b58e2636f7c983241f Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 20 Oct 2016 12:20:18 +0100 Subject: 39688: Skip out of P_EXACTLY pattern loop if P_PURES. If it's really a pure string, there's only one exact match. We could overwrite the next pointer; usually this didn't matter because we'd hit a termination, but if we reallocated we might be looking at garbage. --- Src/pattern.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Src/pattern.c') diff --git a/Src/pattern.c b/Src/pattern.c index 158bfd560..1f2e94bd9 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -677,8 +677,6 @@ patcompile(char *exp, int inflags, char **endexp) p = (Patprog)patout; pd = patout - oldpatout; opnd += pd; - pscan += pd; - next += pd; dst = patout + startoff; } @@ -690,6 +688,8 @@ patcompile(char *exp, int inflags, char **endexp) *dst++ = *opnd++; } } + /* Only one string in a PAT_PURES, so now done. */ + break; } } p->size = dst - patout; -- cgit 1.4.1