If nftnl_ruleset_json_parse() is called with arg == NULL, ctx.data is
left uninitialized and will later be used in nftnl_ruleset_cb(). Avoid
this by using a C99-style initializer for 'ctx' which sets all omitted
fields to zero.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
json_error_t error;
int i, len;
const char *key;
- struct nftnl_parse_ctx ctx;
-
- ctx.cb = cb;
- ctx.format = type;
- ctx.flags = 0;
+ struct nftnl_parse_ctx ctx = {
+ .cb = cb,
+ .format = type,
+ .flags = 0,
+ };
ctx.set_list = nftnl_set_list_alloc();
if (ctx.set_list == NULL)