]> source.dussan.org Git - rspamd.git/commitdiff
Use safe iters for bind_socket parameter.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 25 Dec 2014 23:55:57 +0000 (23:55 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 25 Dec 2014 23:55:57 +0000 (23:55 +0000)
src/libserver/cfg_rcl.c

index 04726fbdae8d3681709a57d090cad21f7262a334..13ef400ed62e3e94bc9d24d6a442ebb1f32dfb5f 100644 (file)
@@ -585,8 +585,8 @@ rspamd_rcl_worker_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
 
        val = ucl_object_find_key (obj, "bind_socket");
        if (val != NULL) {
-               it = NULL;
-               while ((cur = ucl_iterate_object (val, &it, TRUE)) != NULL) {
+               it = ucl_object_iterate_new (val);
+               while ((cur = ucl_object_iterate_safe (it, true)) != NULL) {
                        if (!ucl_object_tostring_safe (cur, &worker_bind)) {
                                continue;
                        }
@@ -596,9 +596,11 @@ rspamd_rcl_worker_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
                                        EINVAL,
                                        "cannot parse bind line: %s",
                                        worker_bind);
+                               ucl_object_iterate_free (it);
                                return FALSE;
                        }
                }
+               ucl_object_iterate_free (it);
        }
 
        wrk->options = (ucl_object_t *)obj;