kbandla / dpkt

fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols
Other
1.09k stars 270 forks source link

ipv6 option unpack: use byte length in the loop #479

Closed crosser closed 4 years ago

crosser commented 4 years ago

self.length is the bit length of the OptsHeader, while in the while loop, we need byte length.

Attempt to continue the loop beyond the data size eventually results in IndexError exception.

This should fix the issue #477

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.04%) to 89.205% when pulling 3691b268d3f2bf0584c5b7317940d568102f7745 on crosser:ipv6-option-unpack-use-byte-length into bc0fc98eab86a06fe3a6c9e9c860ce1e6dca5945 on kbandla:master.

obormot commented 4 years ago

I believe ip6 parser does the right thing. This proposed change breaks existing unit tests.