jsakamoto/ipaddressrange

Incorrect results when Parse (or TryParse)

Closed this issue · 2 comments

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");

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.