summaryrefslogtreecommitdiff
path: root/dns/message.py
diff options
context:
space:
mode:
authorBrian Wellington <bwelling@xbill.org>2020-06-24 17:04:59 -0700
committerBrian Wellington <bwelling@xbill.org>2020-06-24 17:07:46 -0700
commit903b4f7298c06264c3eb9c57e50e15c733a58ffb (patch)
treeb07ae38a27b42e739719ad96170d0f9d98fb2892 /dns/message.py
parenta02c330e4f394f4e5200266ce1b145b9a1731262 (diff)
downloaddnspython-903b4f7298c06264c3eb9c57e50e15c733a58ffb.tar.gz
Fix TTL limiting.
The message code would convert negative TTL into 0, but the TTL could never be negative, as it was read with the '!I' format, which reads unsigned 32 bit integers. We don't want to change that, since OPT flags (which are encoded in the TTL) should be treated as unsigned. Instead, treat all TTLs > (2^31 - 1) as 0.
Diffstat (limited to 'dns/message.py')
-rw-r--r--dns/message.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/dns/message.py b/dns/message.py
index 63a55db..132149d 100644
--- a/dns/message.py
+++ b/dns/message.py
@@ -732,7 +732,7 @@ class _WireReader:
self.message.first)
self.message.had_tsig = True
else:
- if ttl < 0:
+ if ttl > 0x7fffffff:
ttl = 0
if self.updating and \
rdclass in (dns.rdataclass.ANY, dns.rdataclass.NONE):