aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-08 13:55:09 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-08 13:55:09 +0100
commitfe8028c1083719f2597e015f16e1d24a4847244c (patch)
tree80552c866eba24a44fd92cd0f3a256cf2c21006c /src
parente8f8cc343f2d32cbbeeb9fbd95d8bb394a1504e6 (diff)
downloadrspamd-fe8028c1083719f2597e015f16e1d24a4847244c.tar.gz
rspamd-fe8028c1083719f2597e015f16e1d24a4847244c.zip
[Minor] Strip some bad characters from CTE headers
Diffstat (limited to 'src')
-rw-r--r--src/libmime/message.c5
-rw-r--r--src/libmime/mime_parser.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index 9bbd25d32..56f0a0a98 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -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) {
diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c
index dc55efe20..6572f4e88 100644
--- a/src/libmime/mime_parser.c
+++ b/src/libmime/mime_parser.c
@@ -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;