aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/190_Strchop.patch
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2013-08-04 07:44:17 +0000
committerTatsuya Kinoshita <tats@debian.org>2013-08-04 07:44:17 +0000
commitde74188e37b32fd7e2fa3db050117ac7d1e6c259 (patch)
tree85d5d834d1961a670964c4884e31edda6450ead0 /debian/patches/190_Strchop.patch
parentNew patch 180_execdict.patch to fix potentially segfault (diff)
downloadw3m-de74188e37b32fd7e2fa3db050117ac7d1e6c259.tar.gz
w3m-de74188e37b32fd7e2fa3db050117ac7d1e6c259.zip
New patch 190_Strchop.patch to fix potentially segfault
Diffstat (limited to 'debian/patches/190_Strchop.patch')
-rw-r--r--debian/patches/190_Strchop.patch16
1 files changed, 16 insertions, 0 deletions
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 <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';