diff mbox series

[nft,6/9] netlink: handle invalid etype in set_make_key()

Message ID 20230920142958.566615-7-thaller@redhat.com
State Accepted
Delegated to: Pablo Neira
Headers show
Series various cleanups related to enums and struct datatype | expand

Commit Message

Thomas Haller Sept. 20, 2023, 2:26 p.m. UTC
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>
---
 src/netlink.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Pablo Neira Ayuso Sept. 20, 2023, 4:22 p.m. UTC | #1
On Wed, Sep 20, 2023 at 04:26:07PM +0200, Thomas Haller wrote:
> It's not clear to me, what ensures that the etype is always valid.
> Handle a NULL.

Applied, thanks
Pablo Neira Ayuso Sept. 20, 2023, 4:24 p.m. UTC | #2
On Wed, Sep 20, 2023 at 04:26:07PM +0200, Thomas Haller wrote:
> It's not clear to me, what ensures that the etype is always valid.
> Handle a NULL.

Applied, thanks.

> Fixes: 6e48df5329ea ('src: add "typeof" build/parse/print support')

Please remove empty line break between Fixes: tag and Signed-off-by:
in your future patches.

Thanks!
diff mbox series

Patch

diff --git a/src/netlink.c b/src/netlink.c
index 2489e9864151..70ebf382b14f 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)