From b0b33a41a1d2071ee689baaef312b2bd1ed50c13 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Wed, 7 Jun 2000 13:25:32 +0000 Subject: try to get the tests for `strings long enough' right in anchor matching code (11796) --- Src/Zle/compmatch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Src') diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c index 60a2fe7b9..6e7ded42c 100644 --- a/Src/Zle/compmatch.c +++ b/Src/Zle/compmatch.c @@ -535,7 +535,8 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp, } /* Give up if we don't have enough characters for the * line-string and the anchor. */ - if (ll < llen + alen || lw < alen + aol) + if (ll < llen + alen || + (sfx ? (lw < alen + aol) : (lw < alen || iw < aol))) continue; if (mp->flags & CMF_LEFT) { @@ -571,7 +572,8 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp, * string matched by the `*'. */ if (sfx && (savl = l[-(llen + zoff)])) l[-(llen + zoff)] = '\0'; - for (t = 0, tp = w, ct = 0, ict = lw - alen + 1; + for (t = 0, tp = w, ct = 0, + ict = lw - alen + 1 - (sfx ? aol : 0); ict; tp += add, ct++, ict--) { if ((both && -- cgit 1.4.1