diff options
Diffstat (limited to 'dns')
-rw-r--r-- | dns/ipv4.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/dns/ipv4.py b/dns/ipv4.py index ec7d2d2..e117966 100644 --- a/dns/ipv4.py +++ b/dns/ipv4.py @@ -29,6 +29,12 @@ def inet_aton(text): parts = text.split('.') if len(parts) != 4: raise dns.exception.SyntaxError + for part in parts: + if not part.isdigit(): + raise dns.exception.SyntaxError + if len(part) > 1 and part[0] == '0': + # No leading zeros + raise dns.exception.SyntaxError try: bytes = [int(part) for part in parts] return struct.pack('BBBB', *bytes) |