
1996. People discover you can crash almost any machine on the internet by sending it a single malformed ping. The trick is to split the ICMP packet into fragments whose offset and length, once reassembled, add up to more than the 65535 byte maximum an IP packet is ever allowed to be. The target copies them into a buffer sized for the legal maximum, overflows it, and falls over. Windows boxes, printers, routers, all of them went down the same way. Check the reassembled size before it bites.
Objective
Return whether a fragment is safe to reassemble: its end must stay within the 65535 byte IP limit.
Steps
$ reassembled_ok(0, 1000)
1
$ reassembled_ok(65000, 1000)
0
$ reassembled_ok(65535, 0)
1
Expected files
Allowed functions
None. Write every helper yourself.
Loading solutions...