File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed
Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ typedef struct ip_packet {
7575 uint16_t header_checksum ; // checksum
7676 uint8_t src_ip [4 ]; // source IP
7777 uint8_t dst_ip [4 ]; // destination IP
78- uint8_t options [0 ]; // optional, included if if ihl > 5, overlaps data!
78+ uint8_t options [0 ]; // optional, included if ihl > 5, overlaps data!
7979 uint8_t data []; // Packet data
8080} __attribute__((packed )) ip_packet_t ;
8181
Original file line number Diff line number Diff line change @@ -574,7 +574,7 @@ void ip_handle_packet(ip_packet_t* packet, [[maybe_unused]] int n_len) {
574574 for (; cur ; ) {
575575 void * next = cur -> next ;
576576 size_t this_packet_size = ntohs (cur -> packet -> length ) - (cur -> packet -> ihl * 4 );
577- if (cur -> offset + this_packet_size < data_len ) {
577+ if (cur -> offset + this_packet_size <= data_len ) {
578578 void * copy_from = (void * )cur -> packet + cur -> packet -> ihl * 4 ;
579579 memcpy (data_ptr + cur -> offset , copy_from , this_packet_size );
580580 } else {
You can’t perform that action at this time.
0 commit comments