Unverified Commit ea525178 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15087 netfilter: ipset: add missing range check in bitmap_ip_uadt

parents 2c13ab84 d9c5fbd0
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -163,11 +163,8 @@ bitmap_ip_uadt(struct ip_set *set, struct nlattr *tb[],
		ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
		if (ret)
			return ret;
		if (ip > ip_to) {
		if (ip > ip_to)
			swap(ip, ip_to);
			if (ip < map->first_ip)
				return -IPSET_ERR_BITMAP_RANGE;
		}
	} else if (tb[IPSET_ATTR_CIDR]) {
		u8 cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]);

@@ -178,7 +175,7 @@ bitmap_ip_uadt(struct ip_set *set, struct nlattr *tb[],
		ip_to = ip;
	}

	if (ip_to > map->last_ip)
	if (ip < map->first_ip || ip_to > map->last_ip)
		return -IPSET_ERR_BITMAP_RANGE;

	for (; !before(ip_to, ip); ip += map->hosts) {