[GH-ISSUE #1575] A single escape character is accepted by Name::parse, and doesn't round-trip #703

Open
opened 2026-03-15 23:54:16 +03:00 by kerem · 0 comments
Owner

Originally created by @saethlin on GitHub (Oct 25, 2021).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1575

Another finding from fuzzing.

use trust_dns_proto::rr::Name;
use trust_dns_proto::serialize::binary::{BinDecodable, BinEncodable};
fn main() {
    let name = Name::parse("\\", None).unwrap();
    println!("{:?}", name);
    let bytes = name.to_bytes().unwrap();
    println!("{:?}", bytes);
    let name = Name::from_bytes(&bytes).unwrap();
    println!("{:?}", name);
}

Outputs

"\\" None Name("")
Name("")
[0]
Name(".")

Name("") seems definitely wrong to me. Is Name::parse supposed to reject this string?

Originally created by @saethlin on GitHub (Oct 25, 2021). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1575 Another finding from fuzzing. ```rust use trust_dns_proto::rr::Name; use trust_dns_proto::serialize::binary::{BinDecodable, BinEncodable}; fn main() { let name = Name::parse("\\", None).unwrap(); println!("{:?}", name); let bytes = name.to_bytes().unwrap(); println!("{:?}", bytes); let name = Name::from_bytes(&bytes).unwrap(); println!("{:?}", name); } ``` Outputs ``` "\\" None Name("") Name("") [0] Name(".") ``` `Name("")` seems definitely wrong to me. Is `Name::parse` supposed to reject this string?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#703
No description provided.