aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-08-21 19:13:14 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-08-21 19:13:14 +0200
commit4e13b732453105104901c253b7989c16e812c112 (patch)
tree1e17a3d6eb87a6f0cce1ca3b9259b678e884707a
parent6948b408a292db316e86d777e574891ff5cedbfa (diff)
downloadmblaze-4e13b732453105104901c253b7989c16e812c112.tar.gz
mshow: render_mime: avoid indexing into empty buffer
Found using spam corpus at http://untroubled.org/spam/2017-08.7z
-rw-r--r--mshow.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mshow.c b/mshow.c
index 66ccb97..c431108 100644
--- a/mshow.c
+++ b/mshow.c
@@ -270,7 +270,7 @@ nofilter:
strcasecmp(charset, "utf8") == 0 ||
strcasecmp(charset, "us-ascii") == 0) {
print_ascii(body, bodylen);
- if (body[bodylen-1] != '\n')
+ if (bodylen > 0 && body[bodylen-1] != '\n')
putchar('\n');
} else {
print_u8recode(body, bodylen, charset);