about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-05 11:24:16 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-05 11:24:16 +0000
commitee553c9ec0e8ee3e0c4b8f05a43342ea7bcaa24e (patch)
tree3dfa2a97ece69c4a7d1ca0fab2cc8e8568755692
parent163b0101ed6d63c735590d561a8026d74d964401 (diff)
downloadzsh-ee553c9ec0e8ee3e0c4b8f05a43342ea7bcaa24e.tar.gz
zsh-ee553c9ec0e8ee3e0c4b8f05a43342ea7bcaa24e.tar.xz
zsh-ee553c9ec0e8ee3e0c4b8f05a43342ea7bcaa24e.zip
fix for reverse subscripting of strings as second part of subscript ($a[x,(r)..]) (13907)
-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;