From ae12a4453a5e1f06b0a8be344d17f13edec4d96a Mon Sep 17 00:00:00 2001 From: Fusl Date: Thu, 18 Jan 2024 09:50:28 +0000 Subject: [PATCH] fix out of bounds check --- doh.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/doh.c b/doh.c index 7fcab0b..1449f79 100644 --- a/doh.c +++ b/doh.c @@ -598,16 +598,13 @@ static DOHcode doh_decode(unsigned char *doh, if(rc) return rc; /* bad qname */ - if(dohlen < (index + 8)) + if(dohlen < (index + 10)) return DOH_DNS_OUT_OF_RANGE; index += 2; /* type */ index += 2; /* class */ index += 4; /* ttl */ - if(dohlen < (index + 2)) - return DOH_DNS_OUT_OF_RANGE; - rdlength = get16bit(doh, index); index += 2; if(dohlen < (index + rdlength)) @@ -622,7 +619,7 @@ static DOHcode doh_decode(unsigned char *doh, if(rc) return rc; /* bad qname */ - if(dohlen < (index + 8)) + if(dohlen < (index + 10)) return DOH_DNS_OUT_OF_RANGE; index += 2; /* type */