about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/params.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f4de207cd..69c6ea89f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-04-05  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 13907: Src/params.c: fix for reverse subscripting of strings
+	as second part of subscript ($a[x,(r)..])
+
 2001-04-04  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 13902: Completion/Base/Utility/_arguments,
diff --git a/Src/params.c b/Src/params.c
index 1d537d03d..215e5a6f3 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -1113,6 +1113,8 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w)
 		if (beg < 0)
 		    beg += len;
 		if (beg >= 0 && beg < len) {
+                    char *de = d + len;
+
 		    if (a2) {
 			if (down) {
 			    if (!hasbeg)
@@ -1128,7 +1130,7 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w)
 				*t = sav;
 			    }
 			} else
-			    for (r = beg, t = d + beg; *t; r++, t++) {
+			    for (r = beg, t = d + beg; t <= de; r++, t++) {
 				sav = *t;
 				*t = '\0';
 				if (pattry(pprog, d) &&
@@ -1148,7 +1150,7 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w)
 				    return r;
 			    }
 			} else
-			    for (r = beg + 1, t = d + beg; *t; r++, t++)
+			    for (r = beg + 1, t = d + beg; t <= de; r++, t++)
 				if (pattry(pprog, t) &&
 				    !--num)
 				    return r;