Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
Bugfix -> Fixed smale mathe issue
Browse files Browse the repository at this point in the history
  • Loading branch information
EinfacheSache committed Jul 30, 2023
1 parent 1dd8c8f commit 2fb411f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ public static boolean isIPInRange(String ipAddress, String ipRange) {
String startIP = ipRange.split("/")[0];

long startIntAddress = ipToDecimal(startIP);

return targetIntAddress <= (startIntAddress + (long) (32 - range) * (32 - range)) && targetIntAddress >= startIntAddress;
Math.pow(2, (32 - range));
return targetIntAddress <= (startIntAddress + (long) Math.pow(2, (32 - range))) && targetIntAddress >= startIntAddress;
}

public static long ipToDecimal(String ipAddress) throws IllegalArgumentException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public static boolean isIPInRange(String ipAddress, String ipRange) {

long startIntAddress = ipToDecimal(startIP);

return targetIntAddress <= (startIntAddress + (long) (32 - range) * (32 - range)) && targetIntAddress >= startIntAddress;
return targetIntAddress <= (startIntAddress + (long) Math.pow(2, (32 - range))) && targetIntAddress >= startIntAddress;
}

public static long ipToDecimal(String ipAddress) throws IllegalArgumentException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public static boolean isIPInRange(String ipAddress, String ipRange) {

long startIntAddress = ipToDecimal(startIP);

return targetIntAddress <= (startIntAddress + (long) (32 - range) * (32 - range)) && targetIntAddress >= startIntAddress;
return targetIntAddress <= (startIntAddress + (long) Math.pow(2, (32 - range))) && targetIntAddress >= startIntAddress;
}

public static long ipToDecimal(String ipAddress) throws IllegalArgumentException {
Expand Down

0 comments on commit 2fb411f

Please sign in to comment.