summaryrefslogtreecommitdiff
path: root/net/hostapd-devel
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2023-09-11 22:17:36 -0700
committerCy Schubert <cy@FreeBSD.org>2023-09-11 22:51:19 -0700
commit2150c312db2fe116e2ce5024645163948334d1e7 (patch)
tree378e0574e2e8641fd9fa1a9c6cfd8fca4adc2d0b /net/hostapd-devel
parente7f23d81ae4b522701ab73482a3bb3e3a76f6e67 (diff)
downloadfreebsd-ports-2150c312db2fe116e2ce5024645163948334d1e7.zip
net/hostapd-devel: Fix uninitialized packet pointer on error
The packet pointer (called packet) will remain uninitialized when pcap_next_ex() returns an error. This occurs when the wlan interface is shut down using ifconfig destroy. Adding a NULL assignment to packet duplicates what pcap_next() does. The reason we use pcap_next_ex() in this instance is because with pacp_next() when we receive a null pointer if there was an error or if no packets were read. With pcap_next_ex() we can differentiate between an error and legitimately no packets were received. PR: 270649, 273696 Obtained from: src 953efa5b200f Reported by: Robert Morris <rtm@lcs.mit.edu> MFH: 2023Q3
Diffstat (limited to 'net/hostapd-devel')
-rw-r--r--net/hostapd-devel/Makefile2
-rw-r--r--net/hostapd-devel/files/patch-src_l2__packet_l2__packet__freebsd.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/net/hostapd-devel/Makefile b/net/hostapd-devel/Makefile
index 5e4a2bf8feea..06df1ba11977 100644
--- a/net/hostapd-devel/Makefile
+++ b/net/hostapd-devel/Makefile
@@ -1,6 +1,6 @@
PORTNAME= hostapd
PORTVERSION= ${COMMIT_DATE}
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net
PKGNAMESUFFIX= -devel
diff --git a/net/hostapd-devel/files/patch-src_l2__packet_l2__packet__freebsd.c b/net/hostapd-devel/files/patch-src_l2__packet_l2__packet__freebsd.c
index 26ecb22c808c..224ca67ee95f 100644
--- a/net/hostapd-devel/files/patch-src_l2__packet_l2__packet__freebsd.c
+++ b/net/hostapd-devel/files/patch-src_l2__packet_l2__packet__freebsd.c
@@ -1,5 +1,5 @@
---- src/l2_packet/l2_packet_freebsd.c.orig 2022-03-14 01:42:11.000000000 -0700
-+++ src/l2_packet/l2_packet_freebsd.c 2022-04-14 07:36:24.999713000 -0700
+--- src/l2_packet/l2_packet_freebsd.c.orig 2023-09-05 10:38:47.000000000 -0700
++++ src/l2_packet/l2_packet_freebsd.c 2023-09-11 22:12:22.076149000 -0700
@@ -8,7 +8,10 @@
*/
@@ -12,7 +12,7 @@
#include <net/bpf.h>
#endif /* __APPLE__ */
#include <pcap.h>
-@@ -76,24 +79,27 @@
+@@ -76,24 +79,28 @@
{
struct l2_packet_data *l2 = eloop_ctx;
pcap_t *pcap = sock_ctx;
@@ -26,6 +26,7 @@
- packet = pcap_next(pcap, &hdr);
+ if (pcap_next_ex(pcap, &hdr, &packet) == -1) {
+ wpa_printf(MSG_ERROR, "Error reading packet, has device disappeared?");
++ packet = NULL;
+ eloop_terminate();
+ }