mirror of https://github.com/secdev/scapy.git
layers/ipsec: fix padding problems with fuzzed packets
When generating packets with fuzz(), some fields are not initialized completely. This causes problems in evaluating the amount of padding necessary to align the encrypted data length to a multiple of the crypto algorithm block size. This patch forces the encrypted packet fields to be resolved to their default values before calculating the pad length. Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
This commit is contained in:
parent
9201f1cf13
commit
876f5a3361
|
@ -606,9 +606,6 @@ if AES and XCBCMAC:
|
|||
icv_size=12,
|
||||
key_size=(16,))
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
def split_for_transport(orig_pkt, transport_proto):
|
||||
"""
|
||||
|
@ -621,7 +618,8 @@ def split_for_transport(orig_pkt, transport_proto):
|
|||
@return: a tuple (header, nh, payload) where nh is the protocol number of
|
||||
payload.
|
||||
"""
|
||||
header = orig_pkt.copy()
|
||||
# force resolution of default fields to avoid padding errors
|
||||
header = orig_pkt.__class__(str(orig_pkt))
|
||||
next_hdr = header.payload
|
||||
nh = None
|
||||
|
||||
|
|
Loading…
Reference in New Issue