修复Ipv4Util.getEndIpLong 取反符号导致数据越界

This commit is contained in:
Looly
2023-08-21 11:53:29 +08:00
parent 80bdac99d9
commit 713832e5fe
2 changed files with 3 additions and 2 deletions

View File

@@ -407,7 +407,7 @@ public class Ipv4Util {
*/
public static Long getEndIpLong(String ip, int maskBit) {
return getBeginIpLong(ip, maskBit)
+ ~ipv4ToLong(getMaskByMaskBit(maskBit));
+ (0xffffffffL & ~ipv4ToLong(getMaskByMaskBit(maskBit)));
}
/**