diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-08-23 22:26:40 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-08-23 22:26:40 +0100 |
commit | 4dd9c4833430e7eba51e1f11e10dd6644e969000 (patch) | |
tree | 48eb2570c2b896b1fbf13610df9265629f67273a | |
parent | 189acef32f8c581a2c65bcb04306c3ea8585be9e (diff) | |
download | rspamd-4dd9c4833430e7eba51e1f11e10dd6644e969000.tar.gz rspamd-4dd9c4833430e7eba51e1f11e10dd6644e969000.zip |
[Fix] Fix iteration over milter headers
Issue: #4246
-rw-r--r-- | src/libserver/milter.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libserver/milter.c b/src/libserver/milter.c index 7b6fa78ea..a84506720 100644 --- a/src/libserver/milter.c +++ b/src/libserver/milter.c @@ -1784,10 +1784,11 @@ rspamd_milter_process_milter_block (struct rspamd_milter_session *session, ucl_object_iter_t *elt_it; elt_it = ucl_object_iterate_new (cur); + const char *key_name = ucl_object_key (cur); - while ((cur_elt = ucl_object_iterate_safe (elt_it, true)) != NULL) { + while ((cur_elt = ucl_object_iterate_safe (elt_it, false)) != NULL) { if (ucl_object_type (cur_elt) == UCL_STRING) { - hname = g_string_new (ucl_object_key (cur)); + hname = g_string_new (key_name); hvalue = g_string_new (ucl_object_tostring (cur_elt)); rspamd_milter_send_action (session, @@ -1798,7 +1799,7 @@ rspamd_milter_process_milter_block (struct rspamd_milter_session *session, } else if (ucl_object_type (cur_elt) == UCL_OBJECT) { rspamd_milter_extract_single_header (session, - ucl_object_key (cur), cur_elt); + key_name, cur_elt); } else if (ucl_object_type (cur_elt) == UCL_ARRAY) { /* Multiple values for the same key */ @@ -1810,7 +1811,7 @@ rspamd_milter_process_milter_block (struct rspamd_milter_session *session, while ((array_elt = ucl_object_iterate_safe (array_it, true)) != NULL) { rspamd_milter_extract_single_header (session, - ucl_object_key (cur), array_elt); + key_name, array_elt); } ucl_object_iterate_free (array_it); |