From: Phil Sutter Date: Fri, 16 May 2025 17:36:37 +0000 (+0200) Subject: cache: Tolerate object deserialization failures X-Git-Tag: v1.0.6.1~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a28f774755ae2b2eb7c24871f6eaf2257760522;p=thirdparty%2Fnftables.git cache: Tolerate object deserialization failures commit 610089f273c968c983d965f3cac42e4d9784cde8 upstream. If netlink_delinearize_obj() fails, it will print an error message. Skip this object and keep going. Signed-off-by: Phil Sutter Reviewed-by: Pablo Neira Ayuso --- diff --git a/src/cache.c b/src/cache.c index 90eb901e..bbba2103 100644 --- a/src/cache.c +++ b/src/cache.c @@ -740,12 +740,11 @@ static int obj_cache_cb(struct nftnl_obj *nlo, void *arg) uint32_t hash; obj = netlink_delinearize_obj(ctx->nlctx, nlo); - if (!obj) - return -1; - - obj_name = nftnl_obj_get_str(nlo, NFTNL_OBJ_NAME); - hash = djb_hash(obj_name) % NFT_CACHE_HSIZE; - cache_add(&obj->cache, &ctx->table->obj_cache, hash); + if (obj) { + obj_name = nftnl_obj_get_str(nlo, NFTNL_OBJ_NAME); + hash = djb_hash(obj_name) % NFT_CACHE_HSIZE; + cache_add(&obj->cache, &ctx->table->obj_cache, hash); + } return 0; }