Date: Thu, 6 Apr 2023 14:27:59 GMT From: Cy Schubert <cy@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 953efa5b200f - main - wpa_supplicant/hostapd: Fix uninitialized packet pointer on error Message-ID: <202304061427.336ERxU7049003@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=953efa5b200f060564a090ab71b3d7f614a35e3f commit 953efa5b200f060564a090ab71b3d7f614a35e3f Author: Cy Schubert <cy@FreeBSD.org> AuthorDate: 2023-04-06 04:07:15 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2023-04-06 14:27:24 +0000 wpa_supplicant/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 Reported by: Robert Morris <rtm@lcs.mit.edu> Fixes: 6e5d01124fd4 MFC after: 3 days --- contrib/wpa/src/l2_packet/l2_packet_freebsd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/wpa/src/l2_packet/l2_packet_freebsd.c b/contrib/wpa/src/l2_packet/l2_packet_freebsd.c index 0461758ff210..7b96bd033c87 100644 --- a/contrib/wpa/src/l2_packet/l2_packet_freebsd.c +++ b/contrib/wpa/src/l2_packet/l2_packet_freebsd.c @@ -85,6 +85,7 @@ static void l2_packet_receive(int sock, void *eloop_ctx, void *sock_ctx) if (pcap_next_ex(pcap, &hdr, &packet) == -1) { wpa_printf(MSG_ERROR, "Error reading packet, has device disappeared?"); + packet = NULL; eloop_terminate(); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304061427.336ERxU7049003>