From 69b6d5fd0ad7e1e033298ac9c55de2c8ae9e18fa Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 25 Oct 2016 15:41:16 +0200 Subject: [PATCH] [CritFix] Fix iteration over headers array (introduced in 1.4) --- src/libmime/message.c | 4 ++-- src/libutil/util.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libmime/message.c b/src/libmime/message.c index ca05dc4c8..5b14c6f9e 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -60,14 +60,14 @@ append_raw_header (struct rspamd_task *task, if ((ar = g_hash_table_lookup (target, rh->name)) != NULL) { g_ptr_array_add (ar, rh); + msg_debug_task ("append raw header %s: %s", rh->name, rh->value); } else { ar = g_ptr_array_sized_new (2); g_ptr_array_add (ar, rh); g_hash_table_insert (target, rh->name, ar); + msg_debug_task ("add new raw header %s: %s", rh->name, rh->value); } - - msg_debug_task ("add raw header %s: %s", rh->name, rh->value); } /* Convert raw headers to a list of struct raw_header * */ diff --git a/src/libutil/util.h b/src/libutil/util.h index 8bee11b5f..da10e419a 100644 --- a/src/libutil/util.h +++ b/src/libutil/util.h @@ -507,5 +507,5 @@ gpointer rspamd_shmem_xmap (const char *fname, guint mode, */ gdouble rspamd_normalize_probability (gdouble x, gdouble bias); -#define PTR_ARRAY_FOREACH(ar, i, cur) if (ar != NULL) for ((i) = 0, (cur) = g_ptr_array_index((ar), 0); (i) < (ar)->len; (cur) = g_ptr_array_index((ar), (i)), ++(i)) +#define PTR_ARRAY_FOREACH(ar, i, cur) if (ar != NULL) for ((i) = 0, (cur) = g_ptr_array_index((ar), 0); (i) < (ar)->len; (cur) = g_ptr_array_index((ar), (i + 1)), ++(i)) #endif -- 2.39.5