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

Prevent invalid 0-length labels via from_raw_bytes #1700

Merged
merged 1 commit into from
Apr 24, 2022

Conversation

jonasbb
Copy link
Contributor

@jonasbb jonasbb commented Apr 20, 2022

from_raw_bytes allowed the creation of 0-length labels. This is forbidden according to the DNS standard, e.g., RFC 2181, Section 11 "Name Syntax".
The relevant sentence is

The length of any one label is limited to between 1 and 63 octets.

The from_ascii variant already prevented the creation of 0-length labels.

@codecov
Copy link

codecov bot commented Apr 20, 2022

Codecov Report

Merging #1700 (f250738) into main (dc5c414) will decrease coverage by 1.07%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##             main    #1700      +/-   ##
==========================================
- Coverage   79.86%   78.79%   -1.07%     
==========================================
  Files         177      185       +8     
  Lines       18264    18977     +713     
==========================================
+ Hits        14586    14952     +366     
- Misses       3678     4025     +347     

crates/proto/src/rr/domain/label.rs Show resolved Hide resolved
`from_raw_bytes` allowed the creation of 0-length labels. This is
forbidden according to the DNS standard, e.g., RFC 2181,
Section 11 "Name Syntax".
The relevant sentence is
> The length of any one label is limited to between 1 and 63 octets.

The `from_ascii` variant already prevented the creation of 0-length
labels.
Copy link
Member

@bluejekyll bluejekyll left a comment

Choose a reason for hiding this comment

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

This looks good. Thanks for the PR!

@bluejekyll bluejekyll merged commit aa7a7d5 into hickory-dns:main Apr 24, 2022
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.

None yet

3 participants