Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Records with empty rdata causes pack() to fail #63

Closed
peteralm80 opened this issue Feb 16, 2024 · 1 comment
Closed

Records with empty rdata causes pack() to fail #63

peteralm80 opened this issue Feb 16, 2024 · 1 comment

Comments

@peteralm80
Copy link

A DNSRecord instance such as

<DNS Header: id=0x9d1a type=QUERY opcode=UPDATE flags= rcode='NOERROR' zo=1 pr=1 up=3 ad=0>
<DNS Question: 'xxx.net.' qtype=SOA qclass=IN>
<DNS RR: 'yyy.xxx.net.' rtype=CNAME rclass=None ttl=0 rdata=''>
<DNS RR: 'yyy.xxx.net.' rtype=AAAA rclass=* ttl=0 rdata=''>
<DNS RR: 'yyy.xxx.net.' rtype=A rclass=* ttl=0 rdata=''>
<DNS RR: 'yyy.xxx.net.' rtype=A rclass=IN ttl=1200 rdata='192.168.1.2'>

will fail to pack() with the following error:

>>> r.pack()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/peter/.local/lib/python3.12/site-packages/dnslib/dns.py", line 335, in pack
    rr.pack(buffer)
  File "/home/peter/.local/lib/python3.12/site-packages/dnslib/dns.py", line 888, in pack
    self.rdata.pack(buffer)
    ^^^^^^^^^^^^^^^

AttributeError: 'str' object has no attribute 'pack'

I believe the source of the error is

rdata = ''

paulc added a commit that referenced this issue Jul 8, 2024
@paulc
Copy link
Owner

paulc commented Jul 8, 2024

Fixed in 0.9.25 - thanks.

@paulc paulc closed this as completed Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants