Skip to content

Commit

Permalink
Fix infinite recursion in debug formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
isomer committed Dec 28, 2023
1 parent 7354e14 commit ae07ca2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/erbium-core/src/dns/dnspkt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ impl fmt::Display for Question {

impl fmt::Debug for Question {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Question({})", self)
write!(
f,
"Question({:?} {:?} {:?})",
self.qdomain, self.qclass, self.qtype
)
}
}

Expand Down Expand Up @@ -1025,7 +1029,7 @@ impl DNSPkt {
let mut additional = self.additional.clone();

if self.edns.is_some() {
let edns = self.edns.clone().unwrap_or_else(EdnsData::new);
let edns = self.edns.clone().unwrap_or_default();

additional.push(RR {
domain: Domain::from(vec![]),
Expand Down

0 comments on commit ae07ca2

Please sign in to comment.