Merge pull request #395 from ThomasWaldmann/fix-394

avoid invalid IP address crash, fixes #394
This commit is contained in:
TW 2018-11-18 21:02:11 +01:00 committed by GitHub
commit 14d7a4e800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -343,7 +343,8 @@ def _update_or_delete(host, ipaddr, secure=False, logger=None, _delete=False):
ipaddr = str(ipaddr) ipaddr = str(ipaddr)
kind = check_ip(ipaddr, ('ipv4', 'ipv6')) kind = check_ip(ipaddr, ('ipv4', 'ipv6'))
rdtype = 'A' if kind == 'ipv4' else 'AAAA' rdtype = 'A' if kind == 'ipv4' else 'AAAA'
except (ValueError, UnicodeError): IPNetwork(ipaddr) # raise AddrFormatError here if there is an issue with ipaddr, see #394
except (ValueError, UnicodeError, AddrFormatError):
# invalid ip address string # invalid ip address string
# some people manage to even give a non-ascii string instead of an ip addr # some people manage to even give a non-ascii string instead of an ip addr
msg = '%s - received bad ip address: %r' % (fqdn, ipaddr) msg = '%s - received bad ip address: %r' % (fqdn, ipaddr)