diff options
author | Bob Halley <halley@nominum.com> | 2011-07-12 17:56:56 -0700 |
---|---|---|
committer | Bob Halley <halley@nominum.com> | 2011-07-12 17:56:56 -0700 |
commit | e189940dec42495869483f71b0be119bf8956d60 (patch) | |
tree | 1a3469aac345bafc0d507af29379324d61648cd9 /dns | |
parent | 3d7524ab7da01cab4d7dd3857e56fd11e82c061e (diff) | |
download | dnspython-e189940dec42495869483f71b0be119bf8956d60.tar.gz |
increase IPv4 parsing strictness yet more
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) |