summary refs log tree commit diff
path: root/Src/glob.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/glob.c')
-rw-r--r--Src/glob.c4
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,