From: Phil Sutter Date: Fri, 16 May 2025 17:41:19 +0000 (+0200) Subject: netlink: Catch unknown types when deserializing objects X-Git-Tag: v1.0.6.1~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a26dc536263aeecfdd9ccf887de7188627fd94aa;p=thirdparty%2Fnftables.git netlink: Catch unknown types when deserializing objects commit 690f19eadde5cb607ec3d8d471c86d558c7229bd upstream. Print an error message and discard the object instead of returning it to the caller. At least when trying to print it, we would hit an assert() in obj_type_name() anyway. Fixes: 4756d92e517ae ("src: listing of stateful objects") Signed-off-by: Phil Sutter --- diff --git a/src/netlink.c b/src/netlink.c index e5a04d33..58efb6c2 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -1785,6 +1785,10 @@ struct obj *netlink_delinearize_obj(struct netlink_ctx *ctx, obj->synproxy.flags = nftnl_obj_get_u32(nlo, NFTNL_OBJ_SYNPROXY_FLAGS); break; + default: + netlink_io_error(ctx, NULL, "Unknown object type %u", type); + obj_free(obj); + return NULL; } obj->type = type;