Skip to content

Commit

Permalink
Validate TXID in client.py (Issue #30 - thanks to @daniel4x)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulc committed Jan 9, 2022
1 parent baef751 commit 76e8677
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README
Expand Up @@ -357,6 +357,8 @@ Changelog:
Add support for all RR types to NSEC type bitmap
Merge pull request #17 from sunds/issue_16
Issue 16: uncaught exceptions leak open sockets
* 0.9.17 2022-01-09 Validate TXID in client.py (Issue #30 - thanks to @daniel4x)


License:
--------
Expand Down
4 changes: 3 additions & 1 deletion dnslib/__init__.py
Expand Up @@ -359,6 +359,8 @@
Add support for all RR types to NSEC type bitmap
Merge pull request #17 from sunds/issue_16
Issue 16: uncaught exceptions leak open sockets
* 0.9.17 2022-01-09 Validate TXID in client.py (Issue #30 - thanks to @daniel4x)
License:
--------
Expand All @@ -381,7 +383,7 @@

from dnslib.dns import *

version = "0.9.16"
version = "0.9.17"

if __name__ == '__main__':
import doctest,sys,textwrap
Expand Down
3 changes: 3 additions & 0 deletions dnslib/client.py
Expand Up @@ -76,6 +76,9 @@
a_pkt = q.send(address,port,tcp=args.tcp)
a = DNSRecord.parse(a_pkt)

if q.header.id != a.header.id:
raise DNSError('Response transaction id does not match query transaction id')

if a.header.tc and args.noretry == False:
# Truncated - retry in TCP mode
a_pkt = q.send(address,port,tcp=True)
Expand Down

0 comments on commit 76e8677

Please sign in to comment.