From 5b52e7a3f21ba256541fe24d5b7ccff8b700872b Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 10 Apr 2025 19:24:22 +0000 Subject: [PATCH] Build fixes --- libnetutil/netutil.cc | 2 ++ nsock/src/nsock_pcap.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index 5a43c73f9..5cedf5baf 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -137,6 +137,8 @@ typedef unsigned __int8 u_int8_t; #include #endif +#include + #define NBASE_MAX_ERR_STR_LEN 1024 /* Max length of an error message */ #ifndef PCAP_NETMASK_UNKNOWN diff --git a/nsock/src/nsock_pcap.c b/nsock/src/nsock_pcap.c index 8fd0b5d6c..b791efd55 100644 --- a/nsock/src/nsock_pcap.c +++ b/nsock/src/nsock_pcap.c @@ -478,8 +478,8 @@ void nse_readpcap(nsock_event nsev, const unsigned char **l2_data, size_t *l2_le l2l = mp->l3_offset; if (mp->datalink == DLT_EN10MB - && n->caplen >= sizeof(struct eth_hdr) - && 0 == memcmp(n->packet + offsetof(struct eth_hdr, eth_type), "\x81\x00", 2)) + && n->caplen >= 14 /* size of ethernet header */ + && 0 == memcmp(n->packet + 12 /* offset of eth_type */, "\x81\x00", 2)) { l2l += 4; } if (l2l > n->caplen)