From a746e2822a9a4fdc637099f4548b4e04c58e46ae Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 6 Jun 2021 17:36:04 +0200 Subject: [PATCH] Reject large query strings --- src/libdoh/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libdoh/src/lib.rs b/src/libdoh/src/lib.rs index bbdb212..5c1483c 100644 --- a/src/libdoh/src/lib.rs +++ b/src/libdoh/src/lib.rs @@ -155,6 +155,11 @@ impl DoH { } } } + if let Some(question_str) = question_str { + if question_str.len() > MAX_DNS_QUESTION_LEN * 4 / 3 { + return None; + } + } let query = match question_str.and_then(|question_str| { base64::decode_config(question_str, base64::URL_SAFE_NO_PAD).ok() }) {