]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
netlink: Catch unknown types when deserializing objects
authorPhil Sutter <phil@nwl.cc>
Fri, 16 May 2025 17:41:19 +0000 (19:41 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 13 Aug 2025 17:17:22 +0000 (19:17 +0200)
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 <phil@nwl.cc>
src/netlink.c

index e5a04d33d56e4d3411b94dd16e2c97173e86fd99..58efb6c20842bc642176e4f7582591e08c0f24cb 100644 (file)
@@ -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;