From 20e2430f270f0a719600a205feff4896ca26212f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 8 Feb 2024 05:47:15 +0000 Subject: [PATCH] Return early if we get a response with no answers --- src/query.rs | 1 + 1 file changed, 1 insertion(+) 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))?; -- 2.39.5