From c4afeadd05ba7b8d21dbe469f424594b62949f00 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 15 Apr 2016 16:48:56 +0100 Subject: [PATCH] [Fix] Fix processing of empty headers --- src/libmime/message.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libmime/message.c b/src/libmime/message.c index 302717c9d..a28e883a0 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -545,15 +545,22 @@ process_raw_headers (struct rspamd_task *task, GHashTable *target, new->value = tmp; new->decoded = g_mime_utils_header_decode_text (new->value); - rspamd_mempool_add_destructor (task->task_pool, - (rspamd_mempool_destruct_t)g_free, new->decoded); + + if (new->decoded != NULL) { + rspamd_mempool_add_destructor (task->task_pool, + (rspamd_mempool_destruct_t)g_free, new->decoded); + } + else { + new->decoded = ""; + } + append_raw_header (task, target, new); state = 0; break; case 5: /* Header has only name, no value */ new->value = ""; - new->decoded = NULL; + new->decoded = ""; append_raw_header (task, target, new); state = 0; break; -- 2.39.5