kbandla / dpkt

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

fix SCTP decoder DATA chunk padding and handling of .data field #509

Closed obormot closed 3 years ago

obormot commented 3 years ago

This fixes #499 and adds a unit test based on a pcap I found among Wireshark sample captures.

While working on the fix I noticed SCTP decoder incorrectly uses its .data field, basically copying .chunks as seen in this line:

self.data = self.chunks = l

All other dpkt decoders utilize the .data for any bytes remaining after decoding all the known fields (header fields and .chunks in this case), leaving it for other decoders to pick up if necessary. I changed the sctp decoder to align with this convention and use .chunks instead of .data when packing and unpacking. All existing unit tests pass without changes.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.008%) to 92.47% when pulling 0803479b7f1e2381e4ee8b8f95c6b02b323308a8 on fix-#499 into 4ce0b897e60a67fec4b590af058fd702563d79c5 on master.