diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-07-20 18:41:01 +0200 |
|---|---|---|
| committer | Joshua M. Boniface <joshua@boniface.me> | 2020-07-27 18:53:09 -0400 |
| commit | dadd42e5749661e32cdebda422e8ee87ef0695f3 (patch) | |
| tree | 72ccd3526cb708cc1af4233d57d942f52a766496 | |
| parent | 349b789492f0f99657548fbf2e52c1f1d692d303 (diff) | |
Merge pull request #3620 from BaronGreenback/IPFix
Fix for #3607 and #3515
(cherry picked from commit 0750357916b600a4b4c27bc4babd2adcc6390473)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
| -rw-r--r-- | Emby.Server.Implementations/Networking/NetworkManager.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs index 6aa1dfbc9..50cb44b28 100644 --- a/Emby.Server.Implementations/Networking/NetworkManager.cs +++ b/Emby.Server.Implementations/Networking/NetworkManager.cs @@ -152,7 +152,12 @@ namespace Emby.Server.Implementations.Networking return true; } - byte[] octet = IPAddress.Parse(endpoint).GetAddressBytes(); + if (!IPAddress.TryParse(endpoint, out var ipAddress)) + { + return false; + } + + byte[] octet = ipAddress.GetAddressBytes(); if ((octet[0] == 10) || (octet[0] == 172 && (octet[1] >= 16 && octet[1] <= 31)) || // RFC1918 @@ -268,6 +273,12 @@ namespace Emby.Server.Implementations.Networking string excludeAddress = "[" + addressString + "]"; var subnets = LocalSubnetsFn(); + // Include any address if LAN subnets aren't specified + if (subnets.Length == 0) + { + return true; + } + // Exclude any addresses if they appear in the LAN list in [ ] if (Array.IndexOf(subnets, excludeAddress) != -1) { |
