about summary refs log tree commit diff
diff options
context:
space:
mode:
-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--;