]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix TTL limiting.
authorBrian Wellington <bwelling@xbill.org>
Thu, 25 Jun 2020 00:04:59 +0000 (17:04 -0700)
committerBrian Wellington <bwelling@xbill.org>
Thu, 25 Jun 2020 00:07:46 +0000 (17:07 -0700)
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.

dns/message.py

index 63a55dbbe3029cd1cb54d259c7e6e977187599b9..132149dba45d1423a597eb5a7242104c8840aed1 100644 (file)
@@ -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):