]> git.bitcoin.ninja Git - dnssec-prover/commitdiff
Return early if we get a response with no answers
authorMatt Corallo <git@bluematt.me>
Thu, 8 Feb 2024 05:47:15 +0000 (05:47 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 8 Feb 2024 05:47:15 +0000 (05:47 +0000)
src/query.rs

index d81e58a1e1d20eb869b91a59203dd19e61093da1..6f68e09707b210798e7e9f846a528bdadbc9fa1b 100644 (file)
@@ -69,6 +69,7 @@ fn handle_response(resp: &[u8], proof: &mut Vec<u8>) -> Result<Option<RRSig>, 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))?;