From: Matt Corallo Date: Thu, 8 Feb 2024 05:47:15 +0000 (+0000) Subject: Return early if we get a response with no answers X-Git-Tag: v0.5.4~84 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=20e2430f270f0a719600a205feff4896ca26212f;p=dnssec-prover Return early if we get a response with no answers --- diff --git a/src/query.rs b/src/query.rs index d81e58a..6f68e09 100644 --- a/src/query.rs +++ b/src/query.rs @@ -69,6 +69,7 @@ fn handle_response(resp: &[u8], proof: &mut Vec) -> Result, Er let questions = emap(read_u16(&mut read))?; if questions != 1 { return Err(Error::new(ErrorKind::Other, "server responded to multiple Qs")); } let answers = emap(read_u16(&mut read))?; + if answers == 0 { return Err(Error::new(ErrorKind::Other, "No answers")); } let _authorities = emap(read_u16(&mut read))?; let _additional = emap(read_u16(&mut read))?;