Skip to content
Snippets Groups Projects
Commit f4f22a2f authored by Pierre LALET's avatar Pierre LALET
Browse files

Encode rdata for PTR RRs (Timo Juhani Lindfors)

This imports the change made in commit b33a1b7 to scapy-com repository
by Timo Juhani Lindfors <timo.lindfors@iki.fi>.

This fixes issue #566:

Before:

    >>> DNSRR(str(DNSRR(type="PTR", rdata="secdev.org"))).rdata
    WARNING: DNS RR prematured end (ofs=8550, len=8)
    ''

After:

    >>> DNSRR(str(DNSRR(type="PTR", rdata="secdev.org"))).rdata
    'secdev.org.'
parent 39e85281
No related branches found
No related tags found
No related merge requests found
......@@ -194,7 +194,7 @@ class RDataField(StrLenField):
if pkt.type == 1: # A
if s:
s = inet_aton(s)
elif pkt.type in [2,3,4,5]: # NS, MD, MF, CNAME
elif pkt.type in [2, 3, 4, 5, 12]: # NS, MD, MF, CNAME, PTR
s = "".join(map(lambda x: chr(len(x))+x, s.split(".")))
if ord(s[-1]):
s += "\x00"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment