From 4e13b732453105104901c253b7989c16e812c112 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 21 Aug 2017 19:13:14 +0200 Subject: mshow: render_mime: avoid indexing into empty buffer Found using spam corpus at http://untroubled.org/spam/2017-08.7z --- mshow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mshow.c') 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); -- cgit 1.4.1