From nobody Tue Mar 15 18:16:34 2022 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 209131A25D84; Tue, 15 Mar 2022 18:16:35 +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 4KJ1nZ41k6z594c; Tue, 15 Mar 2022 18:16:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647368194; 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=mmyhwWJ/NQezLFMLU4IPL8ErnodMJ5LvefexBBXFaS4=; b=I9nLm4o1a4Rva40RSFEaqk4cTYFersXSiq+70v4tv9+CxqlRMXh8I2rChloS2C2qdu+q9o +SS5UIpSoL515slw88ifTDojJK9/t+iqEI8bRQRSy/IxIl2YvCWxVm8kNAcrsUxPlBmU/8 CqR65yIpB1A85BJpZwVaL7sq6SEfeJ9x0j6J9wytb2Hl0Da/ehlodNKWJyKB3HqHA3esLY cLr2RSX5ZnRt+nm3FHgmwQv2qIzXNeecp3YmLsJGLrAPFJZwg26XVT+BFIUGZMaSh8MQsk XzZPsVI2fj8F0M/LmuZyEI0S6mPScSMKbCpMVYzqmwjDYxT+/u5PRP6vUJgE2g== 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 5651926941; Tue, 15 Mar 2022 18:16:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22FIGY4v075968; Tue, 15 Mar 2022 18:16:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22FIGYAJ075967; Tue, 15 Mar 2022 18:16:34 GMT (envelope-from git) Date: Tue, 15 Mar 2022 18:16:34 GMT Message-Id: <202203151816.22FIGYAJ075967@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a4c0d14bbc9b - releng/12.2 - net80211: correct length check in ieee80211_ies_expand() 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.2 X-Git-Reftype: branch X-Git-Commit: a4c0d14bbc9bfe8e7dff3657d4b4bb1705d8668b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647368194; 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=mmyhwWJ/NQezLFMLU4IPL8ErnodMJ5LvefexBBXFaS4=; b=pmBuC4ie9y2s6vcQMCB7APCF7lUHtAnD4m24BqViupjRll3oZc0x/yZZ45Wgk40vzWSftv SiCInmnBB/RdjIVgE+qUuEPbYMAC2fBO9+HU1JBzceaSiO6Cm+WeF6wRy6hQG3xqqD0z9A uiaH86DbqYJvOCCuS5jVC+bkjIOexjRSwNSoyMxUpKYOvJk+ePV8GHhWBZdmiXKJQgLbMZ fEQa9T896GiVstw5kqjaFW4MlgslWkVwpQnCDZuj1t4ERzbxAgdIcZ2T4jHyCcZvi22FP9 k60PhexOh1ZUhwfTW9oGL8TEb4u8t+0R9lfz+7MH3uXCaODS53KrrnYdUTCFHQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647368194; a=rsa-sha256; cv=none; b=vwISMVxSLrAWDOKPan5zKnDfKPnRF75f3wOYJAZEbV+vykaer/GXFmkv+vvuhJ1rP197l5 N6uC5A80xyPCApqr3Y+mGRnmF/Dd76ja0e9tqoanTbJlsQE6uYjOnImPWb2qEtzWMW7lI8 UBF+0o0QSwisoBPYLUqB1kkbgUBkRArL4cBojyulEwRd3cO1toi1YJLPFdXuuACk3rGJTy 0f9Xoj65fBfwcrxeJImM/veURTZ6Zrqn4v/5llm6tCEjmQuTIfNFGE2UVyZYRDtjwTrIy9 4bEd2Ry06fIAXgc3gCl8Jyv1m7Y/i4UK0vBj8IELT96lmF1xtQ+trpn9Evfqbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a4c0d14bbc9bfe8e7dff3657d4b4bb1705d8668b commit a4c0d14bbc9bfe8e7dff3657d4b4bb1705d8668b Author: Bjoern A. Zeeb AuthorDate: 2021-10-06 18:09:39 +0000 Commit: Mark Johnston CommitDate: 2022-03-15 17:39:17 +0000 net80211: correct length check in ieee80211_ies_expand() In ieee80211_ies_expand() we are looping over Elements (also known as Information Elements or IEs). The comment suggests that we assume well-formedness of the IEs themselves. Checking the buffer length being least 2 (1 byte Element ID and 1 byte Length fields) rather than just 1 before accessing ie[1] is still good practise and can prevent and out-of-bounds read in case the input is not behaving according to the comment. Reported by: (coypu sdf.org) admbugs: 857 MFC after: 3 days Reviewed by: adrian, markj Differential Revision: https://reviews.freebsd.org/D32340 (cherry picked from commit 09dd08f167812a5fdb516fc98f14dbb43221432f) (cherry picked from commit 8dc4c0a922b7e7a0ee682f4e1426f876692c0828) Approved by: so Security: FreeBSD-SA-22:02.wifi --- sys/net80211/ieee80211_node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 9ee5b1b83cde..36dfea039df1 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1134,7 +1134,7 @@ ieee80211_ies_expand(struct ieee80211_ies *ies) ie = ies->data; ielen = ies->len; - while (ielen > 0) { + while (ielen > 1) { switch (ie[0]) { case IEEE80211_ELEMID_VENDOR: if (iswpaoui(ie))