ruby / ipaddr

A class to manipulate an IP address

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CIDR parsing ignores part after second slash

kpricorn opened this issue · comments

Hi.

We use IPAddr to validate user input for valid IP addresses (with or without CIDR notation) and were surprised to see, that the following cases passed validation:

IPAddr.new('192.168.0.1/24/foobar')
=> #<IPAddr: IPv4:192.168.0.0/255.255.255.0>

IPAddr.new('3ffe:505:2::1/0/foobar')
=> #<IPAddr: IPv6:0000:0000:0000:0000:0000:0000:0000:0000/0000:0000:0000:0000:0000:0000:0000:0000>

Is this a valid case or a bug?

This looks already fixed in #17.