]> 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)
committerPhil Sutter <phil@nwl.cc>
Tue, 20 May 2025 10:53:31 +0000 (12:53 +0200)
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 0724190a25d6fe4cca9e42ee6d8620f04e41817a..52010c74d4f30e3197f2b77d3f9c0b8d4827fc96 100644 (file)
@@ -1802,6 +1802,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;