Skip to content

Commit

Permalink
ARP boundary check
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Feb 28, 2025
1 parent 4106ccc commit d758a2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NetworkInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3275,8 +3275,8 @@ bool NetworkInterface::dissectPacket(int32_t if_index,
if (dstMac) dstMac->incRcvdStats(h->ts.tv_sec, 1, len_on_wire);
#endif

if ((eth_type == ETHERTYPE_ARP) &&
(h->caplen >= (sizeof(arp_header) + sizeof(struct ndpi_ethhdr)))) {
if ((eth_type == ETHERTYPE_ARP)
&& (h->caplen >= (ip_offset + sizeof(arp_header)))) {
struct arp_header *arpp = (struct arp_header *)&packet[ip_offset];
u_int16_t arp_opcode = ntohs(arpp->ar_op);

Expand Down

0 comments on commit d758a2e

Please sign in to comment.