From 629ee38dca48651bc8c0eedf2f3a0066a6c0aa5b Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 14 Feb 2020 18:20:29 +0100 Subject: src: Fix for reading garbage in nftnl_chain getters In {s,u}{32,64} type getters nftnl_assert() is called to make sure returned data length matches expectations. Therefore all attributes must set data_len, which NFTNL_CHAIN_DEVICES didn't. While being at it, do the same change for NFTNL_FLOWTABLE_DEVICES as well to make code a bit more consistent although the problem was fixed for flowtables with commit f8eed54150fd4 ("flowtable: Fix for reading garbage") already (but in the other direction). Fixes: e3ac19b5ec162 ("chain: multi-device support") Signed-off-by: Phil Sutter --- src/flowtable.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/flowtable.c') diff --git a/src/flowtable.c b/src/flowtable.c index 1e235d0..635322d 100644 --- a/src/flowtable.c +++ b/src/flowtable.c @@ -230,6 +230,7 @@ const void *nftnl_flowtable_get_data(const struct nftnl_flowtable *c, *data_len = sizeof(int32_t); return &c->family; case NFTNL_FLOWTABLE_DEVICES: + *data_len = 0; return &c->dev_array[0]; case NFTNL_FLOWTABLE_SIZE: *data_len = sizeof(int32_t); -- cgit v1.2.3