summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2022-04-05 09:10:45 -0700
committerBart Schaefer <schaefer@zsh.org>2022-04-05 09:10:45 -0700
commitebad5f8164335ccc6547b1508561726aa6420258 (patch)
tree1c568361ae465d2250b2a2edccbefddc66d41041
parent02747bbbd37d81a2a2fff938e1cc94fb73980848 (diff)
downloadzsh-ebad5f8164335ccc6547b1508561726aa6420258.tar.gz
zsh-ebad5f8164335ccc6547b1508561726aa6420258.tar.xz
zsh-ebad5f8164335ccc6547b1508561726aa6420258.zip
49994: Single-byte equivalence of users/22601 and workers/40891
-rw-r--r--ChangeLog5
-rw-r--r--Src/glob.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b412b883d..d72395705 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-04-05  Bart Schaefer  <schaefer@toltec-ubuntu>
+
+	* 49994: Src/glob.c: Single-byte equivalence of users/22601 and
+	workers/40891 for matching against zero-length strings
+
 2022-04-05  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 49989:  Src/Zle/compresult.c, Src/utils.c, Src/zsh.h: Align
diff --git a/Src/glob.c b/Src/glob.c
index ca28f20e8..400be12d5 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -3331,7 +3331,7 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
 	    /* Largest possible match at tail of string:       *
 	     * move forward along string until we get a match. *
 	     * Again there's no optimisation.                  */
-	    for (ioff = 0, t = s, umlen = uml; t < send;
+	    for (ioff = 0, t = s, umlen = uml; t <= send;
 		 ioff++, t++, umlen--) {
 		set_pat_start(p, t-s);
 		if (pattrylen(p, t, send - t, umlen, &patstralloc, ioff)) {
@@ -3362,7 +3362,7 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
 	    do {
 		/* loop over all matches for global substitution */
 		matched = 0;
-		for (; t < send; t++, ioff++, umlen--) {
+		for (; t <= send; t++, ioff++, umlen--) {
 		    /* Find the longest match from this position. */
 		    set_pat_start(p, t-s);
 		    if (pattrylen(p, t, send - t, umlen, &patstralloc, ioff)) {