Skip to contentSkip to conversation

netlink: fix buffer size for user data in netlink_delinearize_chain()

PATCH In review Thomas Haller 2 participants 2 messages Nov 8, 2023 – Nov 9, 2023 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netlink: fix buffer size for user data in netlink_delinearize_chain()

The correct define is NFTNL_UDATA_CHAIN_MAX and not NFTNL_UDATA_OBJ_MAX. In current libnftnl, they both are defined as 1, so (with current libnftnl) there is no difference.

Fixes 702ac2b72c0e ('src: add comment support for chains')
---
 src/netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/netlink.c +1 -1
index 2876ebad5a78..1d18280bb8c1 100644
@@ -614,7 +614,7 @@ static int qsort_device_cmp(const void *a, const void *b)
 struct chain *netlink_delinearize_chain(struct netlink_ctx *ctx,
 					const struct nftnl_chain *nlc)
 {
-	const struct nftnl_udata *ud[NFTNL_UDATA_OBJ_MAX + 1] = {};
+	const struct nftnl_udata *ud[NFTNL_UDATA_CHAIN_MAX + 1] = {};
 	int priority, policy, len = 0, i;
 	const char * const *dev_array;
 	struct chain *chain;
Signature · 1 line
2.41.0
#1 lore raw
Quoted 3 lines · Thomas Haller

The correct define is NFTNL_UDATA_CHAIN_MAX and not NFTNL_UDATA_OBJ_MAX. In current libnftnl, they both are defined as 1, so (with current libnftnl) there is no difference.

Good catch, applied, thanks Thomas.