]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Strip some bad characters from CTE headers
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 8 Apr 2019 12:55:09 +0000 (13:55 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 8 Apr 2019 12:55:09 +0000 (13:55 +0100)
src/libmime/message.c
src/libmime/mime_parser.c

index 9bbd25d32dd434485fdb93f353eddc52935c9ca4..56f0a0a98b4bbe11fff0650696a4e6eb63713581 100644 (file)
@@ -690,6 +690,11 @@ rspamd_message_process_plain_text_part (struct rspamd_task *task,
                /* Check for ical */
                rspamd_ftok_t cal_ct;
 
+               /*
+                * TODO: If we want to process more than that, we need
+                * to create some generic framework that accepts a part
+                * and returns a processed data
+                */
                RSPAMD_FTOK_ASSIGN (&cal_ct, "calendar");
 
                if (rspamd_ftok_casecmp (&cal_ct, &text_part->mime_part->ct->subtype) == 0) {
index dc55efe205edbfd797a20eb894b2424c0f09e2c8..6572f4e887ef243b315490d44577593e82e0a5bc 100644 (file)
@@ -148,10 +148,13 @@ rspamd_mime_parser_init_lib (void)
 static enum rspamd_cte
 rspamd_mime_parse_cte (const gchar *in, gsize len)
 {
-       guint64 h = rspamd_cryptobox_fast_hash_specific (RSPAMD_CRYPTOBOX_XXHASH64,
-                       in, len, 0xdeadbabe);
+       guint64 h;
        enum rspamd_cte ret = RSPAMD_CTE_UNKNOWN;
 
+       in = rspamd_string_len_strip (in, &len, " \t;,.+-#!`~'");
+       h = rspamd_cryptobox_fast_hash_specific (RSPAMD_CRYPTOBOX_XXHASH64,
+                       in, len, 0xdeadbabe);
+
        switch (h) {
        case 0xCEDAA7056B4753F7ULL: /* 7bit */
                ret = RSPAMD_CTE_7BIT;