diff options
| author | Bob Halley <halley@dnspython.org> | 2021-11-16 07:17:02 -0800 |
|---|---|---|
| committer | Bob Halley <halley@dnspython.org> | 2021-11-16 07:17:02 -0800 |
| commit | e35de75ae3df365055f62f787b3cbe4ba25364cc (patch) | |
| tree | 0e2ee43a72922a81b19f71b0583b368f8f9353f0 /dns | |
| parent | 3d51bf062fc4ef245abc066dead6d3ec0f976459 (diff) | |
| download | dnspython-e35de75ae3df365055f62f787b3cbe4ba25364cc.tar.gz | |
Do not impose 2**31-1 bounds on TTL-like things; impose 2**32-1.
Diffstat (limited to 'dns')
| -rw-r--r-- | dns/ttl.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -19,7 +19,13 @@ import dns.exception -MAX_TTL = 2147483647 +# Technically TTLs are supposed to be between 0 and 2**31 - 1, with values +# greater than that interpreted as 0, but we do not impose this policy here +# as values > 2**31 - 1 occur in real world data. +# +# We leave it to applications to impose tighter bounds if desired. +MAX_TTL = 2**32 - 1 + class BadTTL(dns.exception.SyntaxError): """DNS TTL value is not well-formed.""" @@ -71,7 +77,7 @@ def from_text(text): if not current == 0: raise BadTTL("trailing integer") if total < 0 or total > MAX_TTL: - raise BadTTL("TTL should be between 0 and 2^31 - 1 (inclusive)") + raise BadTTL("TTL should be between 0 and 2**32 - 1 (inclusive)") return total |
