From becc233feb5483b69468910834ff357a5614d0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Landstr=C3=B6m?= Date: Mon, 17 Oct 2022 12:34:24 +0200 Subject: [PATCH] Issue 43: HTTPS reads after RD end --- dnslib/dns.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dnslib/dns.py b/dnslib/dns.py index 2e5e951..d2378e8 100644 --- a/dnslib/dns.py +++ b/dnslib/dns.py @@ -1822,6 +1822,7 @@ def __init__(self, priority, target, params): @classmethod def parse(cls,buffer,length): try: + end = buffer.offset + length priority, = buffer.unpack("!H") target = [] while True: @@ -1831,7 +1832,7 @@ def parse(cls,buffer,length): seg = bytearray(buffer.get(n)) target.append(seg) params = [] - while buffer.remaining() > 0: + while buffer.offset < end: k, = buffer.unpack("!H") n, = buffer.unpack("!H") v = bytearray(buffer.get(n))