warjiang / dpkt

Automatically exported from code.google.com/p/dpkt
Other
0 stars 0 forks source link

[patch] dns.unpack_name improvements #120

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In my research, I ran across a sample that sends random data over UDP port 53, 
and dpkt.dns.DNS was raising IndexError when this happened.  I sat down and 
improved the unpack_name implementation.

The new implementation:
    * is not recursive.
    * detects pointer loops as soon as possible and raises UnpackError.
    * always raises dpkt.UnpackError when the packet is malformed in some way.
    * uses '.'.join() to build the return value instead of repeatedly appending to a string.

This resulted in a series of patches (unit tests and the actual implementation).

Original issue reported on code.google.com by george.m...@gmail.com on 15 Jan 2014 at 2:41

Attachments: