From nobody Tue Mar 15 18:16:13 2022 X-Original-To: dev-commits-src-branches@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 BEF1F1A24D43; Tue, 15 Mar 2022 18:16:14 +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 4KJ1nB0mmfz58mx; Tue, 15 Mar 2022 18:16:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647368174; 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=osXzv1Hk5sFqyUN06fkY3R7GwA42L+78+GWa0u7ESOQ=; b=dvDQwj7tURaNCA90YwVYKUHiWKlYWmW+EsQ5CHIhqxYDH5EtmUy//XoU6iAKdYQpaZwUo1 hYtpJZ6eLKA1zaL6RDEtIh3BbJKdFul6V0mlfd8sIhu6w8wYPPzRoL5OOVFhx98qCTorL2 4l5FF8nixwPhcKHM0PkIlMqBUlx43QTdrQdxfb4+SHbDfcxn+9KUmYwBDoFK6xQtvxV0PN wAVCr8uHKhZdAfQF2/Eag1Iq+YDKcXJQLCqfQchkRja4HeSCjol6RUTnz2piWgzKcFCZM1 vk/bvWJpMQYczMt7YbdqGiijeSAa9ZluMvskbIM+SNJ6J1MSz5EFwfR64Kwa9A== 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 D5C8126B1B; Tue, 15 Mar 2022 18:16:13 +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 22FIGDcl075591; Tue, 15 Mar 2022 18:16:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22FIGD1A075590; Tue, 15 Mar 2022 18:16:13 GMT (envelope-from git) Date: Tue, 15 Mar 2022 18:16:13 GMT Message-Id: <202203151816.22FIGD1A075590@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: 8794413823ab - releng/12.3 - net80211: correct length check in ieee80211_ies_expand() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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.3 X-Git-Reftype: branch X-Git-Commit: 8794413823ab1be9170e08d38dc8c68b853455a7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647368174; 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=osXzv1Hk5sFqyUN06fkY3R7GwA42L+78+GWa0u7ESOQ=; b=pIhzEw9XyLTq/ybVJGb5s/gK9BDO98aJW1vfQsFMfbaeZy0yUj9HerzdCFjrWj+cWNCtXt YmVUHYMfG5QiAORqoeBWgmcuL26Ac4ZoMRu5ud9/7TZ3laHeWBD5xA/piQZ7eUhYOOogSC x6zX0mdXAnr2Ea2w7sVDSlbiniaMdkJEEtyWLxpJzkQ3fvZ748xT6LWQCeZfwcvb99s2qk 8vnHI5kmVp7oyCK+WVib3WrfVfBxiF3DwXBJynYpGEwNveCxnsmBHpT7g7AWwoq4kxv/SY MSsR7oBBXKTn/SkHJa1r4Rd6aFktzToVbzYfRf+Pdo6dbl7iYqsRKzYGFEFJhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647368174; a=rsa-sha256; cv=none; b=n6xeSLi6A39ya3Ws+0KCrxD3zLa2Tk0BXJ6NaXKWOXzBfvkXkEwUqaAcGS0Z+DqnDapNf9 /xLhQ47WVD//tZo+5seJ7eMbXz4xUZtn6FGMBfNt0C/ZCLPEdctzSNV7CBT+kBmcwyy+uz JR2Hde2bsSH65kbmf9ONtO4YUP3gY+dM0PabfLVKIWKk3o7F0Ms3oa8LGZyULkvlR1wW+4 KNrIpoweDOK9vXEXL7QCkclqvF8i9ze/k6vth16xY3EIIlCeQk79hdF3ok3dpt4AWEo7sP MnDKRvhN4TBZQPMdvdSOzvmL26T6V9omLAuKka5hX6+CN/x+f841Cm/mQc391w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8794413823ab1be9170e08d38dc8c68b853455a7 commit 8794413823ab1be9170e08d38dc8c68b853455a7 Author: Bjoern A. Zeeb AuthorDate: 2021-10-06 18:09:39 +0000 Commit: Mark Johnston CommitDate: 2022-03-15 18:15:57 +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))