From f55f9ddeb82ddc7125d0347f438bfc13a1a6791f Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Fri, 14 Aug 2020 13:27:08 -0700 Subject: [PATCH] Handle some invalid IPv6 literals we erroneously allowed. --- dns/ipv6.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dns/ipv6.py b/dns/ipv6.py index 0905aaf1..faadb7c2 100644 --- a/dns/ipv6.py +++ b/dns/ipv6.py @@ -121,7 +121,11 @@ def inet_aton(text, ignore_scope=False): elif l > 2: raise dns.exception.SyntaxError - if text == b'::': + if text == b'': + raise dns.exception.SyntaxError + elif text.endswith(b':') and not text.endswith(b'::'): + raise dns.exception.SyntaxError + elif text == b'::': text = b'0::' # # Get rid of the icky dot-quad syntax if we have it. -- 2.47.3