summaryrefslogtreecommitdiffstats
path: root/src/parser_json.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-08-29 16:25:09 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-08-30 12:19:36 +0200
commit2e62c72974dcb2d4c4db1445ae55310a4f84ec15 (patch)
tree66d428e62a0be95fe5b1a53e9595b16b226576e4 /src/parser_json.c
parent3103776556dc15850f4857339c81b3c453528726 (diff)
parser_json: Fix crash in error reporting
When trying to add a chain to a non-existing table, error reporting tries to dereference indesc pointer of the table's location. Hence make sure the latter is initialized correctly. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/parser_json.c')
-rw-r--r--src/parser_json.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/parser_json.c b/src/parser_json.c
index 6af9d075..514bc46b 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -2212,7 +2212,9 @@ static struct stmt *json_parse_stmt(struct json_ctx *ctx, json_t *root)
static struct cmd *json_parse_cmd_add_table(struct json_ctx *ctx, json_t *root,
enum cmd_ops op, enum cmd_obj obj)
{
- struct handle h = { 0 };
+ struct handle h = {
+ .table.location = *int_loc,
+ };
const char *family = "";
if (json_unpack_err(ctx, root, "{s:s}",
@@ -2250,7 +2252,9 @@ static int parse_policy(const char *policy)
static struct cmd *json_parse_cmd_add_chain(struct json_ctx *ctx, json_t *root,
enum cmd_ops op, enum cmd_obj obj)
{
- struct handle h = { 0 };
+ struct handle h = {
+ .table.location = *int_loc,
+ };
const char *family = "", *policy = "", *type, *hookstr;
int prio;
struct chain *chain;