Closed galosss closed 3 years ago
the fix could be
def __len__(self):
return super().__len__() + len(self.headers_str()[1])
Hi @galosss please see if the referenced PR https://github.com/kbandla/dpkt/pull/566 fixes the issue
yeah it looks good. tnx!
why do you prefer clone some extension headers parse code rather than use len(self.headers_str()[1])
as suggested above?
thanks, Gal
@galosss Thanks! In general we want to avoid serialization (or packing into str/bytes), when we're only trying to calculate the size. My solution does repeat some code but avoids serialization.
Hey there,
there's a bug in IPv6 packets length calculation, using
len(packet)
. IPv6 packet uses the default__len__
implementation of dpkt.Packet, but doesn't take the extensions header into account. It's leading to a bug in length calculation when extensions headers are used, andlen(bytes(packet)) > len(packet)
.thanks.