git: 6f4c310eecc8 - 2023Q3 - net/hostapd: Fix uninitialized packet pointer on error
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 15 Sep 2023 14:08:45 UTC
The branch 2023Q3 has been updated by cy:
URL: https://cgit.FreeBSD.org/ports/commit/?id=6f4c310eecc8e585f5df84ddd2b88cf76f51e543
commit 6f4c310eecc8e585f5df84ddd2b88cf76f51e543
Author: Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-09-12 05:17:18 +0000
Commit: Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-09-15 14:07:44 +0000
net/hostapd: 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>
(cherry picked from commit e7f23d81ae4b522701ab73482a3bb3e3a76f6e67)
---
net/hostapd/Makefile | 2 +-
net/hostapd/files/patch-src_l2__packet_l2__packet__freebsd.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/hostapd/Makefile b/net/hostapd/Makefile
index b6db58496f49..1e6d5841681a 100644
--- a/net/hostapd/Makefile
+++ b/net/hostapd/Makefile
@@ -1,6 +1,6 @@
PORTNAME= hostapd
PORTVERSION= 2.10
-PORTREVISION= 6
+PORTREVISION= 7
CATEGORIES= net
MASTER_SITES= https://w1.fi/releases/
diff --git a/net/hostapd/files/patch-src_l2__packet_l2__packet__freebsd.c b/net/hostapd/files/patch-src_l2__packet_l2__packet__freebsd.c
index c8be8a1c9c12..9d290e5dff5c 100644
--- a/net/hostapd/files/patch-src_l2__packet_l2__packet__freebsd.c
+++ b/net/hostapd/files/patch-src_l2__packet_l2__packet__freebsd.c
@@ -1,5 +1,5 @@
--- src/l2_packet/l2_packet_freebsd.c.orig 2022-01-16 12:51:29.000000000 -0800
-+++ src/l2_packet/l2_packet_freebsd.c 2022-04-14 07:35:30.668820000 -0700
++++ src/l2_packet/l2_packet_freebsd.c 2023-09-11 22:00:09.826831000 -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();
+ }