Skip to content

CIDR parsing ignores part after second slash #29

Description

@kpricorn

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?

Activity

  1. changed the title [-]Unexpected behavior with ipv4 address in CIDR notation containing two or more slashes[/-] [+]CIDR parsing ignores part after second slash[/+] on May 17, 2021
  2. hanazuki commented on Nov 28, 2023

    @hanazuki
    Contributor

    This looks already fixed in #17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions