Skip to content

Commit

Permalink
Handle empty bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
jjxtra committed Nov 2, 2020
1 parent 4e5ffd4 commit c031456
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public LocalMachineExternalIPAddressLookupDefault(IHttpRequestMaker requestMaker
catch (Exception _ex)
{
ex = _ex;
await Task.Delay(600);
await Task.Delay(1000);
}
}

Expand Down
4 changes: 4 additions & 0 deletions IPBanCore/Core/Utility/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,10 @@ public static bool IsInternal(this System.Net.IPAddress ip)
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
byte[] bytes = ip.GetAddressBytes();
if (bytes is null || bytes.Length < 4)
{
return true;
}
switch (bytes[0])
{
case 10:
Expand Down

0 comments on commit c031456

Please sign in to comment.