]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - net/netfilter/ipset/ip_set_hash_ipportnet.c
netfilter: ipset: Limit the maximal range of consecutive elements to add/delete
[mirror_ubuntu-hirsute-kernel.git] / net / netfilter / ipset / ip_set_hash_ipportnet.c
index 8f075b44cf64e0ccd6c50bf6bd7e2d056f0333f3..7df94f437f600f98e48a62dcfb3078b8b01da6e2 100644 (file)
@@ -253,6 +253,9 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
                        swap(port, port_to);
        }
 
+       if (((u64)ip_to - ip + 1)*(port_to - port + 1) > IPSET_MAX_RANGE)
+               return -ERANGE;
+
        ip2_to = ip2_from;
        if (tb[IPSET_ATTR_IP2_TO]) {
                ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2_TO], &ip2_to);