Skip to content

Commit

Permalink
changes from PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuckCottrill committed Feb 20, 2024
1 parent 35aebe8 commit 4bbfd0c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/tcpedit/edit_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,8 @@ fix_ipv4_length(struct pcap_pkthdr *pkthdr, ipv4_hdr_t *ip_hdr, size_t l2len)
int ip_len = (int)ntohs(ip_hdr->ip_len);
int ip_len_want = (int)(pkthdr->len - l2len);

if (pkthdr->caplen < l2len + sizeof(*ip_hdr)) {
ip_hdr->ip_len = htons(ip_len_want);
if (pkthdr->caplen < l2len + sizeof(*ip_hdr))
return -1;
}

if ((htons(ip_hdr->ip_off) & (IP_MF | IP_OFFMASK)) == 0 && ip_len != ip_len_want) {
ip_hdr->ip_len = htons(ip_len_want);
Expand Down

0 comments on commit 4bbfd0c

Please sign in to comment.