From e78ec8610d16732e566526ceb1d513d71ccf942b Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Thu, 23 Mar 2017 21:01:59 +0000
Subject: 40891: fix more zero-length matches.
This time at the end of the trial string.
---
Src/glob.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'Src/glob.c')
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,
--
cgit 1.4.1