From nobody Wed May 27 13:42:12 2026 X-Original-To: dev-commits-src-all@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 4gQW512sL1z6f3mg for ; Wed, 27 May 2026 13:42:13 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQW504Y4bz4KKq for ; Wed, 27 May 2026 13:42:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779889332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1QBxQ7EojWaNwxzDztEBgzb998yIRJxhJ/OKFcBTCDc=; b=SlE7bYObEcrOwUlO3xzcX+huvlazSlDZs1ZCfdcBK8psUzoOTIdmfW9M6Ya2WOGJSjSDs9 qx2Rnhwz4+QrxBJ3vwumWV7Cp8w+4Bx9bPe23jB8gigsTB2PVy+qFdwKaZXfGlslEbN0vj BYKbDHBozWYTerjqhRNqVxZsFTaJnEortEJ6VpBQAl5pVB+OBx90P0U/vU7BA1sh8scQIp jTQkn4SOCNyo4EQtZ7cnbv/2ywsD78Hf79wPF9w7oxCD68HwQf9SuHZJCeYgT7je7B5n78 VbikgUS70je8vjmw+6nnM2ztEjoidIN1jKC8FAkG4gWFJu04CLFFLHK1O5/nmw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779889332; a=rsa-sha256; cv=none; b=YOEcdahcWssUVPyKGfcbCnRHZF0PRlIMUat5tP9ysNAc29cHf6fHO1xJycCrQGV5bhKuia BV5YMffZr05fiRc0cdm71LJoN+aj5KPQCgO06uXJBIPZBEKhHcFF8jiNa9lPVpmj+/NxeI I86u6w+rbjgxApfbyHydAJelzKti/tg/e9tPRwY5wP4BWg5y8+iBNtA3uUugqcyBtP4Pj8 3rHLWSyV2Doz6kVlZNUXkW+f+3iqN3dKMRx1MAV01m0p4qEw2A3zpAZuHVhA8W9EvxrhkG dIuROFEZSb+dvEl0JKdwCWUsBoQk98IZaiLHSGoJ602+S4osLUuounNAux6KUg== 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=1779889332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1QBxQ7EojWaNwxzDztEBgzb998yIRJxhJ/OKFcBTCDc=; b=Al8wafYId8ZuAk6X4ffyconJaA3zGHtcXvO4phkSV7VGg1tdDwQXBAEe6bKJT3Uy927ipj EdFuFk+uDB1tD9qJ/F+p62LgEDXJ0KjNlsHLwj/PJha908msUIj7GddvcYR8DPDvQe7V7U 4WYRBTd/7zhgiovOA4RKOoK380JqMxSV+LIpAx13FW8lZOMlFy01pq+mZWHQlsRYxHZM12 N6VIxAIylXUlO0saY8BqSekqaHjr7vsM+7KrweWpdpwcC0LuKs/psooaEx1W3/vuIpW473 vnxgT0B4ikRPEVhl6XQvUdk16OtydmeYXWZMFsu7UKX1EpBugt6hZVWJP8q7Ew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQW503C34z1260 for ; Wed, 27 May 2026 13:42:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1c814 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 13:42:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Teddy Engel From: Cy Schubert Subject: git: 36ab14d79529 - stable/14 - ipfilter: Fix NULL dereferences in ipf_checkicmp6matchingstate() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 36ab14d7952997b102ca07ae2b61590b52144078 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 13:42:12 +0000 Message-Id: <6a16f4b4.1c814.1af10b9f@gitrepo.freebsd.org> The branch stable/14 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=36ab14d7952997b102ca07ae2b61590b52144078 commit 36ab14d7952997b102ca07ae2b61590b52144078 Author: Teddy Engel AuthorDate: 2026-05-19 21:36:33 +0000 Commit: Cy Schubert CommitDate: 2026-05-27 13:42:02 +0000 ipfilter: Fix NULL dereferences in ipf_checkicmp6matchingstate() Add NULL checks for ic6 (the ICMPv6 header pointer from fin->fin_dp) and oic (the inner ICMPv6 header from ofin.fin_dp after ipf_makefrip). These pointers can be NULL when processing malformed ICMPv6 error packets with extension headers. Also fix the length validation: the original check (fin->fin_plen < sizeof(ip6_t)) could never trigger because an earlier check already ensures fin->fin_plen >= ICMP6ERR_MINPKTLEN (48). Replace with a proper check that fin->fin_dlen contains at least ICMPERR_ICMPHLEN + sizeof(ip6_t) bytes to ensure sufficient data exists for both the ICMPv6 error header and the embedded IPv6 header. PR: 288333 Pull Request: https://github.com/freebsd/freebsd-src/pull/2214 Signed-off-by: Teddy Engel (cherry picked from commit c028080749c09e68c555155df0e9f681ba63c6ae) --- sys/netpfil/ipfilter/netinet/ip_state.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/ipfilter/netinet/ip_state.c b/sys/netpfil/ipfilter/netinet/ip_state.c index bfb9b9eb19f3..a22e19db15aa 100644 --- a/sys/netpfil/ipfilter/netinet/ip_state.c +++ b/sys/netpfil/ipfilter/netinet/ip_state.c @@ -4368,9 +4368,13 @@ ipf_checkicmp6matchingstate(fr_info_t *fin) } ic6 = fin->fin_dp; + if (ic6 == NULL) { + SBUMPD(ipf_state_stats, iss_icmp6_miss); + return (NULL); + } oip6 = (ip6_t *)((char *)ic6 + ICMPERR_ICMPHLEN); - if (fin->fin_plen < sizeof(*oip6)) { + if (fin->fin_dlen < ICMPERR_ICMPHLEN + sizeof(*oip6)) { SBUMPD(ipf_state_stats, iss_icmp_short); return (NULL); } @@ -4412,6 +4416,10 @@ ipf_checkicmp6matchingstate(fr_info_t *fin) if (oip6->ip6_nxt == IPPROTO_ICMPV6) { oic = ofin.fin_dp; + if (oic == NULL) { + SBUMPD(ipf_state_stats, iss_icmp6_miss); + return (NULL); + } /* * an ICMP error can only be generated as a result of an * ICMP query, not as the response on an ICMP error