From: Petr Vaganov Date: Mon, 20 Jul 2026 08:04:47 +0000 (+0700) Subject: ipsecmod: fix deref on null in ipsecmod-whitelist after OOM (#1475) X-Git-Tag: release-1.26.0rc1~44 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=a2fe5356b59533d4c062a8e4567c6bb7f2088f61;p=thirdparty%2Funbound.git ipsecmod: fix deref on null in ipsecmod-whitelist after OOM (#1475) 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 --- diff --git a/ipsecmod/ipsecmod-whitelist.c b/ipsecmod/ipsecmod-whitelist.c index c2b1f5d4a..0ff59145f 100644 --- a/ipsecmod/ipsecmod-whitelist.c +++ b/ipsecmod/ipsecmod-whitelist.c @@ -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);