diff --git a/include/utils.h b/include/utils.h index 8af5a8e973fa..53999c982c56 100644 --- a/include/utils.h +++ b/include/utils.h @@ -30,7 +30,7 @@ void __noreturn __abi_breakage(const char *file, int line, const char *reason); void __nftnl_assert_fail(uint16_t attr, const char *filename, int line); #define nftnl_assert(val, attr, expr) \ - ((!val || expr) \ + ((!val || data_len == 0 || expr) \ ? (void)0 \ : __nftnl_assert_fail(attr, __FILE__, __LINE__)) diff --git a/src/chain.c b/src/chain.c index b4066e4d4e88..94a9e43a1754 100644 --- a/src/chain.c +++ b/src/chain.c @@ -364,6 +364,7 @@ const void *nftnl_chain_get_data(const struct nftnl_chain *c, uint16_t attr, *data_len = strlen(c->dev) + 1; return c->dev; case NFTNL_CHAIN_DEVICES: + *data_len = 0; return &c->dev_array[0]; } return NULL; diff --git a/src/flowtable.c b/src/flowtable.c index 1e235d0ba50f..635322d7fa56 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);