commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (VALIDATOR-421) InetAddressValidator IPV4 rejects IPs with leading 0's in octets
Date Thu, 06 Apr 2017 11:39:41 GMT

    [ https://issues.apache.org/jira/browse/VALIDATOR-421?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15958777#comment-15958777
] 

Sebb commented on VALIDATOR-421:
--------------------------------

bq. According to Wikipedia "It [IPv4] also allowed ...

In the above quote, "It" refers to 

bq. A popular implementation of IP networking, originating in 4.2BSD

AFAICT it does not refer to any IPv4 standard.

The Wikipedia article also notes that:  

bq. addresses where an IP address component is written with a leading zero digit may be interpreted
differently by different programs: some will ignore the leading zero, some will interpret
the number as octal.

AFAICT there is no agreed standard here.

At present if an address validates OK, the string can be unambiguously converted to an InetAddress.

If the proposal were adopted, AFAICT such a guarantee would no longer hold.
In particular, it looks as though Oracle Java 8 ignores leading zeros (i.e. treats them as
decimail) and does not support 0x prefixes.

> InetAddressValidator IPV4 rejects IPs with leading 0's in octets
> ----------------------------------------------------------------
>
>                 Key: VALIDATOR-421
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-421
>             Project: Commons Validator
>          Issue Type: Bug
>          Components: Routines
>    Affects Versions: 1.6
>            Reporter: Matt Kusnierz
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message