Fix the issue with invalid scoped IPv6 addresses in InetAddressUtils.#388
Merged
Conversation
ok2c
requested changes
Feb 10, 2023
| * @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); |
Member
There was a problem hiding this comment.
@arturobernalg How about folding this method into #isIPv6Address and doing input.indexOf(SCOPE_ID_DELIMITER) only once?
3fca5d6 to
ed2268e
Compare
Member
|
@arturobernalg Could you please change the target branch to 5.3.x? Otherwise looks good. |
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 '-'.
ed2268e to
3bf38de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.