about summary refs log tree commit diff
path: root/Src/Zle/compmatch.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-07-06 10:01:19 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-07-06 10:01:19 +0000
commit75f853f2e309bd2ed98209eb64b47ca2bdcf46fb (patch)
treed6e7f30b7b65fa747952e9664950bacc54b7760a /Src/Zle/compmatch.c
parent3538c874b10191e802dc47d8bbf7867750651fb1 (diff)
downloadzsh-75f853f2e309bd2ed98209eb64b47ca2bdcf46fb.tar.gz
zsh-75f853f2e309bd2ed98209eb64b47ca2bdcf46fb.tar.xz
zsh-75f853f2e309bd2ed98209eb64b47ca2bdcf46fb.zip
21402: Fix crash with case-insensitive matching.
Diffstat (limited to 'Src/Zle/compmatch.c')
-rw-r--r--Src/Zle/compmatch.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index 90823c9f7..7054feb6d 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -803,14 +803,26 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 		    /* Probably add the matched strings. */
 		    if (!test) {
 			if (sfx)
-			    add_match_str(NULL, NULL, w, ow - w, sfx);
+			{
+			    if (ow >= w)
+				add_match_str(NULL, NULL, w, ow - w, sfx);
+			}
 			else
-			    add_match_str(NULL, NULL, ow, w - ow, sfx);
+			{
+			    if (w >= ow)
+				add_match_str(NULL, NULL, ow, w - ow, sfx);
+			}
 			add_match_str(mp, tl, tw, mp->wlen, sfx);
 			if (sfx)
-			    add_match_sub(NULL, NULL, 0, w, ow - w);
+			{
+			    if (ow >= w)
+				add_match_sub(NULL, NULL, 0, w, ow - w);
+			}
 			else
-			    add_match_sub(NULL, NULL, 0, ow, w - ow);
+			{
+			    if (w >= ow)
+				add_match_sub(NULL, NULL, 0, ow, w - ow);
+			}
 			add_match_sub(mp, tl, mp->llen, tw, mp->wlen);
 		    }
 		    if (sfx) {