Sitelet https://web.archive.org/web/20220320114646/https://github.com/dnsjava/dnsjava/pull/165
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have constructing relative Name with length() == MAXNAME fail #165

Merged
merged 1 commit into from Feb 16, 2021

Conversation

nresare
Copy link
Member

@nresare nresare commented Feb 15, 2021

The Name() constructor will currently fail if it's length() would
end up being longer than MAXNAME (255). However, there is an edge
case where a relative name can be exactly MAXNAME long. This is
legal but the lookup mechanism will then fail to make the name
absolute by appending an empty label to be able to use it for
lookups.

The Name() constructor will currently fail if it's length() would
end up being longer than MAXNAME (255). However, there is an edge
case where a relative name can be exactly MAXNAME long. This is
legal but the lookup mechanism will then fail to make the name
absolute by appending an empty label to be able to use it for
lookups.
@nresare nresare requested a review from ibauersachs Feb 15, 2021
@sonarcloud
Copy link

@sonarcloud sonarcloud bot commented Feb 15, 2021

Copy link
Member

@ibauersachs ibauersachs left a comment

I hope this doesn't break stuff. But comparing it with ldns, I think it's okay. Although ldns allows creating a 3x63+62 relative name with status OK, it fails to do anything with it later on, including to converting back to string. ldns even violates it's own guarantee that an rdf internally is always absolute in the 3x63+62 case and returns a length of 256.

String label62 = IntStream.range(0, 62).mapToObj(i -> "a").collect(Collectors.joining());
assertThrows(
TextParseException.class,
() -> new Name(format("%s.%s.%s.%s", label63, label63, label63, label62)));
Copy link
Member

@ibauersachs ibauersachs Feb 15, 2021

Choose a reason for hiding this comment

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

I'm not used to importing anything statically other than assertions or (sometimes) constants.

@nresare nresare merged commit 0697e5b into master Feb 16, 2021
10 checks passed
@nresare nresare deleted the disallow_relative_MAXNAME_long_name branch Feb 16, 2021
@ibauersachs ibauersachs added this to the 3.4 milestone Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants