about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-05-13 20:22:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-05-13 20:22:01 +0000
commit4bfa5cd4215a9994b3c6da291d8b52f2c0f6553d (patch)
treed9c99d9f781b950f91397f5f3f7d93bc4e3f8881
parent599a7fd7a7ce420766324b1a57a83d2c5c6cebf6 (diff)
downloadzsh-4bfa5cd4215a9994b3c6da291d8b52f2c0f6553d.tar.gz
zsh-4bfa5cd4215a9994b3c6da291d8b52f2c0f6553d.tar.xz
zsh-4bfa5cd4215a9994b3c6da291d8b52f2c0f6553d.zip
23435: Nikloai Weibull: bug testing end of string for sorting when ignoring
backslashes
-rw-r--r--ChangeLog5
-rw-r--r--Src/sort.c3
2 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b3d92d4c3..8f806927e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 2007-05-13  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
-	* Phil Pennoc: unposted: Doc/Zsh/cond.yo: should document
+	* 23435: Nikolai Weibull: Src/sort.c: bug testing for end
+	of sort string when ignoring backslashes.
+
+	* Phil Pennock: unposted: Doc/Zsh/cond.yo: should document
 	POSIX regular expressions as extended, not basic.
 
 	* 23436: Src/params.c: handle empty strings for locale
diff --git a/Src/sort.c b/Src/sort.c
index 4f091deb8..7f539a248 100644
--- a/Src/sort.c
+++ b/Src/sort.c
@@ -338,8 +338,9 @@ strmetasort(char **array, int sortwhat, int *unmetalenp)
 		src = dst;
 	    }
 	    if (sortwhat & SORTIT_IGNORING_BACKSLASHES) {
+                char *end = src + len + 1;
 		/* copy null byte, so increment length */
-		for (s = src, t = dst; s - src != len+1; ) {
+		for (s = src, t = dst; s < end; ) {
 		    if (*s == '\\') {
 			s++;
 			len--;