]> 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>
Fri, 3 Nov 2023 11:23:37 +0000 (12:23 +0100)
commit c4186c5376ee73efff005dbd23dd73a8e06e6ad8 upstream.

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 a34071218be50469042980877d5e2cb5e735cc5d..8d517c101701329bc48a884eb4f3985ff0a74486 100644 (file)
@@ -893,6 +893,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)