Skip to content

Commit 2c7a1e9

Browse files
minor frag tweaks
1 parent fb8d643 commit 2c7a1e9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/ip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

src/net/ip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)