From nobody Tue Sep 12 05:53:08 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RlCRn2qCqz4sYZT; Tue, 12 Sep 2023 05:53:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RlCRn0rT3z3dHG; Tue, 12 Sep 2023 05:53:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694497989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AKKd0L68tY2xJZ0jAws5iWnPWvs6hgQUMVPJRpj7s/8=; b=lEQIrO97IpEUTc+6/d5kDdVaTiBjgrlYVTOUkCKpega9XVpHYlmBE42Afowhpli5SBKi6j MAGZdwDjGcj8ibUCPtLP2Wgau0HviFiMK0BnQEUJMeFeNdzSsUgOIo5ur4UTAXqZoUOok0 /PJkBpYOVuzw4m4sJ8UbNOi4z6YB9Y7PjJmRmiS+baYZXKcefbk34Wfg7Xh+wUiRPcSof3 RsKXZ/uaWlSKMHirM4bt8ZDfCvG9gQ3lqjfXIDR7TFOqiNvM+eMM/eAb/0/cEWf6XeFRCB uwsYkSoHy1CK6cTNk1GTbgnbYe4T6pbzeIESeEpzzt29ZdA2Ngok721bB+CUAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694497989; a=rsa-sha256; cv=none; b=q62w1bzrb7qGCQ+MkP3rY75QDUFvmokffOlg9pGUxdrb8NJiT3e2AeS/SkJoZoW1E3Hzej Ax9mBapoV7bEuS/b8CPfjXp2+VsAKQv7IFrx8WaMaEAEB4bTzpsRw35ewd0emGcHrm9xtd 4bU4x1x5Vru3YACjZZK9YMv7YuSM71RiFiQs4aZJfZH1FIxijLwkTh0NhaGszL7LXeEdcj N6y/j7jGW9RFyO/6b5azPaMH5Fd5NDPLcaIax4rV2xixUkjly4aDsHNqXzSleuFBMW69gl hJWG0/Pw7Oa7Sd3MT8Q0Df5DMQdixq6nSjAwZ2l5LM9dy1vs9SMwCOxJEDDSNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694497989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AKKd0L68tY2xJZ0jAws5iWnPWvs6hgQUMVPJRpj7s/8=; b=F9OB9S+78y0wDfic/i0p+TWfOxi+KUBaHB8Al3RKEuB4OnStXSDi1exovw20CvVlbNA4WM kgJhgQ9/zChyO67AT15OK5lVAFYhZsyxRrvMmRAphCysH0MmzcOSG/rRu/ADFYkRyWS4IS fb1RPTmnrMgUb+7H8RebVfOwNGvtelvdNxouWHa5gSzPD88ZwOn7C4QMrm+EH1DWyzwR9r wgvkNdZoybeQJYAnT6QsEeszM+5n7r/H2TLmKaRDDruQxIGL2cFluKte3OSbcRbsa6Xj+r BN79IdnUXDabmCeNNgbd1CfC1MHfcsFwhUv1dWYYOAhPlohE0cOa/MLRxRHvJA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RlCRm73GFz575; Tue, 12 Sep 2023 05:53:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38C5r8OM086770; Tue, 12 Sep 2023 05:53:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38C5r8a4086767; Tue, 12 Sep 2023 05:53:08 GMT (envelope-from git) Date: Tue, 12 Sep 2023 05:53:08 GMT Message-Id: <202309120553.38C5r8a4086767@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Cy Schubert Subject: git: a872b8a14f51 - main - security/wpa_supplicant-devel: Fix uninitialized packet pointer on error List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a872b8a14f51721830232b127cc6ac27663a903d Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/ports/commit/?id=a872b8a14f51721830232b127cc6ac27663a903d commit a872b8a14f51721830232b127cc6ac27663a903d Author: Cy Schubert AuthorDate: 2023-09-12 05:17:05 +0000 Commit: Cy Schubert CommitDate: 2023-09-12 05:51:13 +0000 security/wpa_supplicant-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 MFH: 2023Q3 --- security/wpa_supplicant-devel/Makefile | 2 +- .../patch-src_l2__packet_l2__packet__freebsd.c | 28 +++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/security/wpa_supplicant-devel/Makefile b/security/wpa_supplicant-devel/Makefile index d28ed3db5b82..ccc6c1b32cdd 100644 --- a/security/wpa_supplicant-devel/Makefile +++ b/security/wpa_supplicant-devel/Makefile @@ -1,6 +1,6 @@ PORTNAME= wpa_supplicant PORTVERSION= ${COMMIT_DATE} -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= security net PKGNAMESUFFIX= -devel diff --git a/security/wpa_supplicant-devel/files/patch-src_l2__packet_l2__packet__freebsd.c b/security/wpa_supplicant-devel/files/patch-src_l2__packet_l2__packet__freebsd.c index 62365bdc9900..224ca67ee95f 100644 --- a/security/wpa_supplicant-devel/files/patch-src_l2__packet_l2__packet__freebsd.c +++ b/security/wpa_supplicant-devel/files/patch-src_l2__packet_l2__packet__freebsd.c @@ -1,5 +1,5 @@ --- 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:06:24.154851000 -0700 ++++ src/l2_packet/l2_packet_freebsd.c 2023-09-11 22:12:22.076149000 -0700 @@ -8,7 +8,10 @@ */ @@ -12,15 +12,37 @@ #include #endif /* __APPLE__ */ #include -@@ -82,7 +85,10 @@ +@@ -76,24 +79,28 @@ + { + struct l2_packet_data *l2 = eloop_ctx; + pcap_t *pcap = sock_ctx; +- struct pcap_pkthdr hdr; ++ struct pcap_pkthdr *hdr; + const u_char *packet; + struct l2_ethhdr *ethhdr; unsigned char *buf; size_t len; - 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(); + } - if (!l2->rx_callback || !packet || hdr.caplen < sizeof(*ethhdr)) +- if (!l2->rx_callback || !packet || hdr.caplen < sizeof(*ethhdr)) ++ if (!l2->rx_callback || !packet || hdr->caplen < sizeof(*ethhdr)) return; + + ethhdr = (struct l2_ethhdr *) packet; + if (l2->l2_hdr) { + buf = (unsigned char *) ethhdr; +- len = hdr.caplen; ++ len = hdr->caplen; + } else { + buf = (unsigned char *) (ethhdr + 1); +- len = hdr.caplen - sizeof(*ethhdr); ++ len = hdr->caplen - sizeof(*ethhdr); + } + l2->rx_callback(l2->rx_callback_ctx, ethhdr->h_source, buf, len); + }