Uploaded image for project: 'Commons Validator'
  1. Commons Validator
  2. VALIDATOR-421

InetAddressValidator IPV4 rejects IPs with leading 0's in octets

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Component/s: Routines
    • Labels:
      None

      Description

      According to Wikipedia "It [IPv4] also allowed the numbers to be written in hexadecimal and octal, by prefixing them with 0x and 0, respectively", but org.apache.commons.validator.routines.InetAddressValidator.isValidInet4Address(String) rejects IPs if an ipSegment starts with a leading 0.

      So leading 0's should be detected first, and then used to try and parseInt using the octal radix.

      The ipv4 regex also doesn't support hex notation.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              matthew.kusnierz@gmail.com Matt Kusnierz
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: