From 4bbfd0c9737b257ed2b49385546aee7a54334eba Mon Sep 17 00:00:00 2001 From: Charles Cottrill Date: Tue, 20 Feb 2024 11:14:36 -0500 Subject: [PATCH] changes from PR review --- src/tcpedit/edit_packet.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tcpedit/edit_packet.c b/src/tcpedit/edit_packet.c index caefbbcc..1025ff90 100644 --- a/src/tcpedit/edit_packet.c +++ b/src/tcpedit/edit_packet.c @@ -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);