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 {
${result} = Scan Message With Rspamc ${TESTDIR}/messages/f.zip.001.eml
Should Not Contain ${result.stdout} MIME_ARCHIVE_IN_ARCHIVE
+Empty text part should not be treat as html
+ ${result} = Scan Message With Rspamc ${TESTDIR}/messages/empty-plain-text.eml
+ Should Not Contain ${result.stdout} FORGED_OUTLOOK_HTML
+
*** Keywords ***
MIMETypes Setup
${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/mime_types.conf
--- /dev/null
+Return-Path: test@test.com
+From: TEST <test@test.com>
+MIME-Version: 1.0
+X-Priority: 1 (Highest)
+X-MSMail-Priority: High
+X-Mailer: Microsoft Outlook 16.0
+Importance: High
+Date: Mon, 23 Jul 2018 16:24:13 +0200
+Message-ID: <d9946a191e0c97733a86424c48e65eca@test.com>
+Subject: Test Subject
+To: Me <me@me.me>
+Content-Type: text/plain; charset="UTF-8"
+
+