aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/190_Strchop.patch
blob: e27861f0a5f11f70f0c14962daeefe214c1ad38b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Subject: Check length for Strchop()
From: Tatsuya Kinoshita <tats@debian.org>

--- a/Str.c
+++ b/Str.c
@@ -278,8 +278,8 @@ void
 Strchop(Str s)
 {
     STR_LENGTH_CHECK(s);
-    while ((s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r') &&
-	   s->length > 0) {
+    while (s->length > 0 &&
+	   (s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r')) {
 	s->length--;
     }
     s->ptr[s->length] = '\0';