summaryrefslogtreecommitdiff
path: root/dns/rdata.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-08-21 09:20:17 -0700
committerBob Halley <halley@dnspython.org>2020-08-21 09:20:17 -0700
commitf789de1e6521cdd5ca11917522259a22ed902ab3 (patch)
treeb288f34bfdb64141ce14ce367afc98906026f2ed /dns/rdata.py
parent683dc5d0c0d3180c778e53e6abdd7ea48b4a3950 (diff)
downloaddnspython-f789de1e6521cdd5ca11917522259a22ed902ab3.tar.gz
Detect and reject attempts to use compressed names in the generic rdata
syntax of a known type.
Diffstat (limited to 'dns/rdata.py')
-rw-r--r--dns/rdata.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/dns/rdata.py b/dns/rdata.py
index 0d8f881..a5d3a66 100644
--- a/dns/rdata.py
+++ b/dns/rdata.py
@@ -468,6 +468,16 @@ def from_text(rdclass, rdtype, tok, origin=None, relativize=True,
relativize, relativize_to)
rdata = from_wire(rdclass, rdtype, grdata.data, 0,
len(grdata.data), origin)
+ #
+ # If this comparison isn't equal, then there must have been
+ # compressed names in the wire format, which is an error,
+ # there being no reasonable context to decompress with.
+ #
+ rwire = rdata.to_wire()
+ if rwire != grdata.data:
+ raise dns.exception.SyntaxError('compressed data in '
+ 'generic syntax form '
+ 'of known rdatatype')
if rdata is None:
rdata = cls.from_text(rdclass, rdtype, tok, origin, relativize,
relativize_to)