aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-19 20:48:14 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-19 20:48:14 +0000
commitfd06870b8f0095e5eeae385cb037b08703caeead (patch)
tree1702050bd7698714a17c72c36ac6419947406137
parent5640329874764ee3b0f0a5bc9fcb96cdfd11a66f (diff)
downloadrspamd-fd06870b8f0095e5eeae385cb037b08703caeead.tar.gz
rspamd-fd06870b8f0095e5eeae385cb037b08703caeead.zip
Fix processing of empty messages.
Issue: #486 Reported by: @moisseev
-rw-r--r--src/libmime/message.c4
-rw-r--r--src/libutil/str_util.c4
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;
}