netfilter: nf_tables: reject NFT_SET_CONCAT with not field length description
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 15 Jan 2024 11:50:29 +0000 (12:50 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 17 Jan 2024 11:02:51 +0000 (12:02 +0100)
It is still possible to set on the NFT_SET_CONCAT flag by specifying a
set size and no field description, report EINVAL in such case.

Fixes: 1b6345d4160e ("netfilter: nf_tables: check NFT_SET_CONCAT flag if field_count is specified")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index 88a6a858383b61fd8d45df47ad9c40696e6ab2bb..4b55533ce5ca2c29b1648b4f36de3e835c8953a6 100644 (file)
@@ -5070,8 +5070,12 @@ static int nf_tables_newset(struct sk_buff *skb, const struct nfnl_info *info,
                if (err < 0)
                        return err;
 
-               if (desc.field_count > 1 && !(flags & NFT_SET_CONCAT))
+               if (desc.field_count > 1) {
+                       if (!(flags & NFT_SET_CONCAT))
+                               return -EINVAL;
+               } else if (flags & NFT_SET_CONCAT) {
                        return -EINVAL;
+               }
        } else if (flags & NFT_SET_CONCAT) {
                return -EINVAL;
        }