Skip to content

Commit

Permalink
Fix ReservedAddress checking (#14)
Browse files Browse the repository at this point in the history
Mask was incorrectly calculated.
  • Loading branch information
nikthechampiongr authored Nov 20, 2024
1 parent 1d85b82 commit 450e822
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Lidgren.Network/NetReservedAddress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static bool IsAddressReserved(IPAddress address)

foreach (var (reservedIp, maskBits) in ReservedRanges)
{
var mask = uint.MaxValue << maskBits;
var mask = uint.MaxValue << (32 - maskBits);
if ((ipBits & mask) == (reservedIp & mask))
return true;
}
Expand Down

0 comments on commit 450e822

Please sign in to comment.