about summary refs log tree commit diff
path: root/Src/pattern.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-10-20 12:20:18 +0100
committerPeter Stephenson <pws@zsh.org>2016-10-20 12:20:18 +0100
commit11343d89efcb027b4a8855b58e2636f7c983241f (patch)
tree42621447221a3fc071b2bbde70de2f8a40e6e4dc /Src/pattern.c
parentd2c9f85f59ab7e58af68c5f89b64a95ac26e1e43 (diff)
downloadzsh-11343d89efcb027b4a8855b58e2636f7c983241f.tar.gz
zsh-11343d89efcb027b4a8855b58e2636f7c983241f.tar.xz
zsh-11343d89efcb027b4a8855b58e2636f7c983241f.zip
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.
Diffstat (limited to 'Src/pattern.c')
-rw-r--r--Src/pattern.c4
1 files changed, 2 insertions, 2 deletions
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;