From: Pablo Neira Ayuso Date: Mon, 10 Jun 2019 11:32:47 +0000 (+0200) Subject: src: invalid read when importing chain name (trace and json) X-Git-Tag: v0.9.1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=619327e350d4f0f6915043d2127001fdf097b8b2;p=thirdparty%2Fnftables.git 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 --- diff --git a/src/netlink.c b/src/netlink.c index e9779684a..7a4312498 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 081cf5da7..ac110f16f 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,