]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix processing of empty headers
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 15 Apr 2016 15:48:56 +0000 (16:48 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 15 Apr 2016 15:48:56 +0000 (16:48 +0100)
src/libmime/message.c

index 302717c9d03cfdc25d7e4ccdde69a251b95cd513..a28e883a025265f59ea22fbbd6aff294fb4b774b 100644 (file)
@@ -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;