diff options
| author | Bob Halley <halley@dnspython.org> | 2020-08-21 09:20:17 -0700 |
|---|---|---|
| committer | Bob Halley <halley@dnspython.org> | 2020-08-21 09:20:17 -0700 |
| commit | f789de1e6521cdd5ca11917522259a22ed902ab3 (patch) | |
| tree | b288f34bfdb64141ce14ce367afc98906026f2ed /dns/rdata.py | |
| parent | 683dc5d0c0d3180c778e53e6abdd7ea48b4a3950 (diff) | |
| download | dnspython-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.py | 10 |
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) |
