jsakamoto / ipaddressrange

.NET Class Library for range of IP address, both IPv4 and IPv6.
Mozilla Public License 2.0
370 stars 71 forks source link

Incorrect results when Parse (or TryParse) #44

Closed DimitriR closed 6 years ago

DimitriR commented 6 years ago

Incorrect results and false positive responses when passing wrong IP addresses. For example:

IPAddressRange.TryParse("192. 168.1.0 - 192. 168.1.0", out rr);
IPAddressRange.TryParse("192.1.1 - 192.1.1", out rr);

var aa1 = IPAddressRange.Parse("192.168.1");
var aa2 = IPAddressRange.Parse("192.168.1111");
jsakamoto commented 6 years ago

Thank you for your reporting!

192.1.1, 192.168.1 and 192.168.1111 are all valid IPv4 address form in some platforms that include .NET Framework.

image

See also: https://nxmnpg.lemoda.net/3/inet_aton#5

But, 192. 168.1.0 (192.{some spaces}168.1.0) is invalid format.

image

I'll fix the case that including spaces pattern to treat invalid format.

jsakamoto commented 6 years ago

I released v.3.1.1.

https://www.nuget.org/packages/IPAddressRange/3.1.1