Skip to content

Fix the issue with invalid scoped IPv6 addresses in InetAddressUtils.#388

Merged
ok2c merged 1 commit into
apache:5.3.xfrom
arturobernalg:feature/HTTPCORE-674
Feb 10, 2023
Merged

Fix the issue with invalid scoped IPv6 addresses in InetAddressUtils.#388
ok2c merged 1 commit into
apache:5.3.xfrom
arturobernalg:feature/HTTPCORE-674

Conversation

@arturobernalg
Copy link
Copy Markdown
Member

This Pull Request addresses the issue of properly handling scoped IPv6 addresses in the InetAddressUtils class. The previous implementation had incorrect behavior when handling scoped IPv6 addresses. This fix updates the logic to properly check the format of the scope ID and to return false when the address is not a valid standard or compressed IPv6 address.

* @return {@code true} if the string represents a valid scoped IPv6 address, {@code false} otherwise
*/
private static boolean isIPv6ScopedAddress(final String input) {
final int index = input.indexOf(SCOPE_ID_DELIMITER);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arturobernalg How about folding this method into #isIPv6Address and doing input.indexOf(SCOPE_ID_DELIMITER) only once?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @ok2c
Yes. sound logical.
TY

@ok2c
Copy link
Copy Markdown
Member

ok2c commented Feb 10, 2023

@arturobernalg Could you please change the target branch to 5.3.x? Otherwise looks good.

@arturobernalg arturobernalg changed the base branch from master to 5.3.x February 10, 2023 15:09
This commit implements a check to ensure that scoped IPv6 addresses provided as input to the InetAddressUtils are valid. The check ensures that the address conforms to either the standard or hex-compressed format, and that the scope ID consists only of alphanumeric characters or '-'.
@ok2c ok2c merged commit 0975d4f into apache:5.3.x Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants