From ba827bb22b43294438efafd87b9319eebd763f94 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 10 Feb 2004 02:30:14 +0000 Subject: [PATCH] Another fix in sub_match() to avoid allowing a partial-meta match to occur (this time in the backwards scan). --- Src/Zle/compmatch.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c index 410078a7b..750b4cb58 100644 --- a/Src/Zle/compmatch.c +++ b/Src/Zle/compmatch.c @@ -1593,10 +1593,15 @@ sub_match(Cmdata md, char *str, int len, int sfx) l < len && l < md->len && p[ind] == q[ind]; l++, p += add, q += add) {} - /* Make sure we don't end with a widowed Meta (which can only - * happen in a forward scan). */ - if (l && add == 1 && p[-1] == Meta) - l--; + /* Make sure we don't end in the middle of a Meta sequence. */ + if (add == 1) { + if (l && p[-1] == Meta) + l--; + } else { + if (l && ((l < len && p[-1] == Meta) + || (l < md->len && q[-1] == Meta))) + l--; + } if (l) { /* There was a common prefix, use it. */ md->len -= l; len -= l;