[
https://issues.apache.org/jira/browse/VALIDATOR-419?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Denis Iskhakov updated VALIDATOR-419:
-------------------------------------
Description:
{{InetAddressValidator.getInstance().isValidInet6Address(String inet6Address)}}
returns {{true}} for value
{{0::1:192.168.1.1:192.168.1.1}}
I believe this is due to wrong comparison operand in line #166 of
InetAddressValidator:
{code}
if (index > octets.length - 1 || index > 6) { // CHECKSTYLE IGNORE MagicNumber
// IPV4 occupies last two octets
return false;
}
{code}
{{index > octets.length - 1}} expression will never be true inside cycle
{code}for (int index = 0; index < octets.length; index++){code}
was:
{{InetAddressValidator.getInstance().isValidInet6Address(String inet6Address)}}
returns {{true}} for value
{code}
0::1:192.168.1.1:192.168.1.1
{code}
I believe this is due to wrong comparison operand in line #166 of
InetAddressValidator: {code}index > octets.length - 1{code} expression will
never be true inside cycle {code}for (int index = 0; index < octets.length;
index++){code}
> Invalid IPv6 address passes InetAddressValidator validation
> -----------------------------------------------------------
>
> Key: VALIDATOR-419
> URL: https://issues.apache.org/jira/browse/VALIDATOR-419
> Project: Commons Validator
> Issue Type: Bug
> Components: Routines
> Affects Versions: 1.5.1
> Reporter: Denis Iskhakov
> Priority: Minor
>
> {{InetAddressValidator.getInstance().isValidInet6Address(String
> inet6Address)}} returns {{true}} for value
> {{0::1:192.168.1.1:192.168.1.1}}
> I believe this is due to wrong comparison operand in line #166 of
> InetAddressValidator:
> {code}
> if (index > octets.length - 1 || index > 6) { // CHECKSTYLE IGNORE
> MagicNumber
> // IPV4 occupies last two octets
> return false;
> }
> {code}
> {{index > octets.length - 1}} expression will never be true inside cycle
> {code}for (int index = 0; index < octets.length; index++){code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)