From d413a9fe656591bfb94def878c63e1768c30c522 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 26 Dec 2017 17:12:11 +0000 Subject: [Fix] Replace space like characters in headers with plain space --- src/libmime/mime_headers.c | 10 ++++++++-- src/libserver/re_cache.c | 5 +++-- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c index 0564379e4..81a7b666a 100644 --- a/src/libmime/mime_headers.c +++ b/src/libmime/mime_headers.c @@ -516,8 +516,14 @@ rspamd_mime_header_sanity_check (GString *str) for (i = 0; i < str->len; i ++) { t = str->str[i]; - if (!((t & 0x80) || g_ascii_isgraph (t) || t == ' ')) { - str->str[i] = '?'; + if (!((t & 0x80) || g_ascii_isgraph (t))) { + if (g_ascii_isspace (t)) { + /* Replace spaces characters with plain space */ + str->str[i] = ' '; + } + else { + str->str[i] = '?'; + } } } } diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index 9aad6b591..d0e17603d 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -809,9 +809,10 @@ rspamd_re_cache_exec_re (struct rspamd_task *task, ret = rspamd_re_cache_process_regexp_data (rt, re, task, scvec, lenvec, headerlist->len, raw); - msg_debug_re_task ("checking header %s regexp: %s -> %d", + msg_debug_re_task ("checking header %s regexp: %s=%*s -> %d", re_class->type_data, - rspamd_regexp_get_pattern (re), ret); + rspamd_regexp_get_pattern (re), + (int)lenvec[0], scvec[0], ret); g_free (scvec); g_free (lenvec); } -- cgit v1.2.3