about summary refs log tree commit diff
path: root/Src/sort.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/sort.c')
-rw-r--r--Src/sort.c3
1 files changed, 2 insertions, 1 deletions
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--;