diff options
Diffstat (limited to 'src/libmime/message.c')
-rw-r--r-- | src/libmime/message.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c index 6208f6424..76f63ed1a 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -675,16 +675,21 @@ rspamd_message_process_text_part (struct rspamd_task *task, RSPAMD_FTOK_ASSIGN (&html_tok, "<!DOCTYPE html"); RSPAMD_FTOK_ASSIGN (&xhtml_tok, "<html"); - if (rspamd_lc_cmp (mime_part->parsed_data.begin, html_tok.begin, - MIN (html_tok.len, mime_part->parsed_data.len)) == 0 || - rspamd_lc_cmp (mime_part->parsed_data.begin, xhtml_tok.begin, - MIN (xhtml_tok.len, mime_part->parsed_data.len)) == 0) { - msg_info_task ("found html part pretending to be text/plain part"); + if (mime_part->parsed_data.len >= xhtml_tok.len && + rspamd_lc_cmp (mime_part->parsed_data.begin, xhtml_tok.begin, xhtml_tok.len)) { + found_html = TRUE; + } + else if (mime_part->parsed_data.len >= html_tok.len && + rspamd_lc_cmp (mime_part->parsed_data.begin, html_tok.begin, html_tok.len)) { found_html = TRUE; } else { found_txt = TRUE; } + + if (found_html) { + msg_info_task ("found html part pretending to be text/plain part"); + } } } else { |