]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
ipsecmod: fix deref on null in ipsecmod-whitelist after OOM (#1475)
authorPetr Vaganov <petrvaganoff@gmail.com>
Mon, 20 Jul 2026 08:04:47 +0000 (15:04 +0700)
committerGitHub <noreply@github.com>
Mon, 20 Jul 2026 08:04:47 +0000 (10:04 +0200)
DEREF_OF_NULL.RET.STAT Return value of a function 'rbtree_create'
is dereferenced at ipsecmod-whitelist.c:105 without checking for
NULL, but it is usually checked for this function (5/6).

In ipsecmod_whitelist_apply_cfg(), the return value of rbtree_create()
is not checked for NULL before being used.

Found by the static analyzer Svace (ISP RAS).

Signed-off-by: Petr Vaganov <petrvaganoff@gmail.com>
ipsecmod/ipsecmod-whitelist.c

index c2b1f5d4a5962b6da486e7b5e2f10ceca08da4b7..0ff59145f40fdf8305c35c8a2ca2f7dc291562be 100644 (file)
@@ -100,6 +100,8 @@ ipsecmod_whitelist_apply_cfg(struct ipsecmod_env* ie,
        struct config_file* cfg)
 {
        ie->whitelist = rbtree_create(name_tree_compare);
+       if (!ie->whitelist)
+               return 0;
        if(!read_whitelist(ie->whitelist, cfg))
                return 0;
        name_tree_init_parents(ie->whitelist);