summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2019-06-10 13:32:47 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2019-06-10 13:37:41 +0200
commit619327e350d4f0f6915043d2127001fdf097b8b2 (patch)
tree1f9baab8d7fa16c9934150f0f26cc0213a99d458 /src
parent142350f154c78a1aeccebc6115440162986dc906 (diff)
src: invalid read when importing chain name (trace and json)
Update trace and json too. Fixes: 142350f154c7 ("src: invalid read when importing chain name") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/netlink.c3
-rw-r--r--src/parser_json.c2
2 files changed, 2 insertions, 3 deletions
diff --git a/src/netlink.c b/src/netlink.c
index e9779684..7a431249 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -1172,8 +1172,7 @@ static void trace_print_verdict(const struct nftnl_trace *nlt,
chain_expr = constant_expr_alloc(&netlink_location,
&string_type,
BYTEORDER_HOST_ENDIAN,
- NFT_CHAIN_MAXNAMELEN
- * BITS_PER_BYTE,
+ strlen(chain) * BITS_PER_BYTE,
chain);
}
expr = verdict_expr_alloc(&netlink_location, verdict, chain_expr);
diff --git a/src/parser_json.c b/src/parser_json.c
index 081cf5da..ac110f16 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -1059,7 +1059,7 @@ static struct expr *json_alloc_chain_expr(const char *chain)
return NULL;
return constant_expr_alloc(int_loc, &string_type, BYTEORDER_HOST_ENDIAN,
- NFT_CHAIN_MAXNAMELEN * BITS_PER_BYTE, chain);
+ strlen(chain) * BITS_PER_BYTE, chain);
}
static struct expr *json_parse_verdict_expr(struct json_ctx *ctx,