From: Thomas Haller Date: Wed, 20 Sep 2023 14:26:07 +0000 (+0200) Subject: netlink: handle invalid etype in set_make_key() X-Git-Tag: v1.0.9~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c4186c5376ee73efff005dbd23dd73a8e06e6ad8;p=thirdparty%2Fnftables.git netlink: handle invalid etype in set_make_key() 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 Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/netlink.c b/src/netlink.c index 2489e986..70ebf382 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -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)