netfilter: nf_tables: sanitize nft_set_desc_concat_parse()
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 27 May 2022 07:56:18 +0000 (09:56 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 31 May 2022 21:13:10 +0000 (23:13 +0200)
commitfecf31ee395b0295f2d7260aa29946b7605f7c85
tree6d90cad797014df56c589ad7e3310946d04ff78a
parent09e545f7381459c015b6fa0cd0ac6f010ef8cc25
netfilter: nf_tables: sanitize nft_set_desc_concat_parse()

Add several sanity checks for nft_set_desc_concat_parse():

- validate desc->field_count not larger than desc->field_len array.
- field length cannot be larger than desc->field_len (ie. U8_MAX)
- total length of the concatenation cannot be larger than register array.

Joint work with Florian Westphal.

Fixes: f3a2181e16f1 ("netfilter: nf_tables: Support for sets with multiple ranged fields")
Reported-by: <zhangziming.zzm@antgroup.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c