mshow: render_mime: avoid indexing into empty buffer

Found using spam corpus at http://untroubled.org/spam/2017-08.7z
pull/74/head
Leah Neukirchen 7 years ago
parent 6948b408a2
commit 4e13b73245

@ -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);

Loading…
Cancel
Save