]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
netlink: handle invalid etype in set_make_key()
authorThomas Haller <thaller@redhat.com>
Wed, 20 Sep 2023 14:26:07 +0000 (16:26 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 20 Sep 2023 16:22:48 +0000 (18:22 +0200)
It's not clear to me, what ensures that the etype is always valid.
Handle a NULL.

Fixes: 6e48df5329ea ('src: add "typeof" build/parse/print support')
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/netlink.c

index 2489e986415148b149f722c6ac6b16cd6eb7b097..70ebf382b14f73d535177253c85ccfedb796cbd6 100644 (file)
@@ -896,6 +896,8 @@ static struct expr *set_make_key(const struct nftnl_udata *attr)
 
        etype = nftnl_udata_get_u32(ud[NFTNL_UDATA_SET_TYPEOF_EXPR]);
        ops = expr_ops_by_type(etype);
+       if (!ops)
+               return NULL;
 
        expr = ops->parse_udata(ud[NFTNL_UDATA_SET_TYPEOF_DATA]);
        if (!expr)