diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2017-03-23 21:01:59 +0000 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2017-03-23 21:01:59 +0000 |
commit | e78ec8610d16732e566526ceb1d513d71ccf942b (patch) | |
tree | 987354530748fd218b8e9c54f544b60323a1fc78 /Src/glob.c | |
parent | 086656241c3ccca377474bfea1cb269ac9a67d60 (diff) | |
download | zsh-e78ec8610d16732e566526ceb1d513d71ccf942b.tar.gz zsh-e78ec8610d16732e566526ceb1d513d71ccf942b.tar.xz zsh-e78ec8610d16732e566526ceb1d513d71ccf942b.zip |
40891: fix more zero-length matches.
This time at the end of the trial string.
Diffstat (limited to 'Src/glob.c')
-rw-r--r-- | Src/glob.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Src/glob.c b/Src/glob.c index 9ac0ae66c..af5d0821c 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -2929,7 +2929,7 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr, * move forward along string until we get a match. * * Again there's no optimisation. */ mb_charinit(); - for (ioff = 0, t = s, umlen = umltot; t < send ; ioff++) { + for (ioff = 0, t = s, umlen = umltot; t <= send ; ioff++) { set_pat_start(p, t-s); if (pattrylen(p, t, umlen, 0, &patstralloc, ioff)) { *sp = get_match_ret(&imd, t-s, umltot); @@ -2937,6 +2937,8 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr, } if (fl & SUB_START) break; + if (t == send) + break; umlen -= iincchar(&t, send - t); } if (!(fl & SUB_START) && pattrylen(p, send, 0, 0, |