From fd06870b8f0095e5eeae385cb037b08703caeead Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 19 Jan 2016 20:48:14 +0000 Subject: [PATCH] Fix processing of empty messages. Issue: #486 Reported by: @moisseev --- src/libmime/message.c | 4 ++-- src/libutil/str_util.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libmime/message.c b/src/libmime/message.c index f7b76640a..854b9e561 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -1357,7 +1357,7 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data) mime_part->raw_headers = g_hash_table_new (rspamd_strcase_hash, rspamd_strcase_equal); rspamd_mempool_add_destructor (task->task_pool, - (rspamd_mempool_destruct_t) g_hash_table_destroy, + (rspamd_mempool_destruct_t) g_hash_table_unref, mime_part->raw_headers); if (hdrs != NULL) { process_raw_headers (task, mime_part->raw_headers, @@ -1423,7 +1423,7 @@ mime_foreach_callback (GMimeObject * part, gpointer user_data) mime_part->raw_headers = g_hash_table_new (rspamd_strcase_hash, rspamd_strcase_equal); rspamd_mempool_add_destructor (task->task_pool, - (rspamd_mempool_destruct_t) g_hash_table_destroy, + (rspamd_mempool_destruct_t) g_hash_table_unref, mime_part->raw_headers); if (hdrs != NULL) { process_raw_headers (task, mime_part->raw_headers, diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c index 62d71dd2c..d8e2dab0c 100644 --- a/src/libutil/str_util.c +++ b/src/libutil/str_util.c @@ -1267,6 +1267,10 @@ rspamd_string_find_eoh (GString *input) } } + if (state == got_linebreak_lf) { + return c - input->str; + } + return -1; } -- 2.39.5