Skip to content

Commit

Permalink
Apply guedou suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
gpotter2 committed Sep 17, 2023
1 parent 1d1ba3c commit b5b47b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion scapy/layers/inet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,10 @@ def _defrag_iter_and_check_offsets(frags):
for pkt, o, length in frags:
if offset != o:
if offset > o:
warning("Fragment overlap (%i > %i) on %r" % (offset, o, pkt))
op = ">"
else:
op = "<"
warning("Fragment overlap (%i %s %i) on %r" % (offset, op, o, pkt))
raise BadFragments
offset += length
yield bytes(pkt[IP].payload)
Expand Down
6 changes: 5 additions & 1 deletion test/scapy/layers/inet.uts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ assert raw(dissected_packets[0]) == raw(packet)

pkts = fragment(IP(dst="10.0.0.5")/ICMP()/("X"*1500))
pkts.insert(1, ARP())
assert len(sniff(offline=pkts, session=IPSession)) == 2
assert len(pkts) == 3

pkts = sniff(offline=pkts, session=IPSession)
assert len(pkts) == 2
assert pkts[1].load == b"X" * 1500

= StringBuffer

Expand Down

0 comments on commit b5b47b7

Please sign in to comment.