aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/cfg_utils.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-10 12:36:12 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-10 12:36:12 +0000
commitfe3edc0dfa04158efee4fa935ab2640095265063 (patch)
tree14f0fe99c718a321e71724030a53e289eec790a2 /src/libserver/cfg_utils.c
parentcb846eabcdd306de3ff54c77ad0184f08850dead (diff)
downloadrspamd-fe3edc0dfa04158efee4fa935ab2640095265063.tar.gz
rspamd-fe3edc0dfa04158efee4fa935ab2640095265063.zip
[Fix] Fix usage of unsafe ucl iterators
Diffstat (limited to 'src/libserver/cfg_utils.c')
-rw-r--r--src/libserver/cfg_utils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 8ee284212..606ef3cf7 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -1698,7 +1698,9 @@ rspamd_config_radix_from_ucl (struct rspamd_config *cfg,
break;
case UCL_ARRAY:
/* List of IP addresses */
- while ((cur = ucl_iterate_object (cur_elt, &it, true)) != NULL) {
+ it = ucl_object_iterate_new (cur_elt);
+
+ while ((cur = ucl_object_iterate_safe (it, true)) != NULL) {
str = ucl_object_tostring (cur);
if (str == NULL || !radix_add_generic_iplist (str, target, TRUE)) {
@@ -1710,9 +1712,13 @@ rspamd_config_radix_from_ucl (struct rspamd_config *cfg,
radix_destroy_compressed (*target);
}
+ ucl_object_iterate_free (it);
+
return FALSE;
}
}
+
+ ucl_object_iterate_free (it);
break;
default:
g_set_error (err, g_quark_from_static_string ("rspamd-config"),