From de74188e37b32fd7e2fa3db050117ac7d1e6c259 Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Sun, 4 Aug 2013 16:44:17 +0900 Subject: New patch 190_Strchop.patch to fix potentially segfault --- debian/patches/190_Strchop.patch | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 debian/patches/190_Strchop.patch (limited to 'debian/patches/190_Strchop.patch') diff --git a/debian/patches/190_Strchop.patch b/debian/patches/190_Strchop.patch new file mode 100644 index 0000000..e27861f --- /dev/null +++ b/debian/patches/190_Strchop.patch @@ -0,0 +1,16 @@ +Subject: Check length for Strchop() +From: Tatsuya Kinoshita + +--- 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'; -- cgit v1.2.3