* [PATCH nft] src: invalid read when importing chain name (trace and json)
@ 2019-06-10 11:36 Pablo Neira Ayuso
0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2019-06-10 11:36 UTC (permalink / raw)
To: netfilter-devel
Fixes: 142350f154c7 ("src: invalid read when importing chain name")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
Accidentally pushed out previous patch, sorry.
src/netlink.c | 3 +--
src/parser_json.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/netlink.c b/src/netlink.c
index e9779684ac09..7a4312498ce8 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 081cf5da7f39..ac110f16fe81 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,
--
2.11.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-10 11:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-10 11:36 [PATCH nft] src: invalid read when importing chain name (trace and json) Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).