From patchwork Tue Jul 19 09:56:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sabrina Dubroca X-Patchwork-Id: 650093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rtwTv5dQVz9s9c for ; Tue, 19 Jul 2016 19:58:27 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPRmv-0006YJ-PA; Tue, 19 Jul 2016 09:58:05 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPRmp-0006S9-Rw for hostap@lists.infradead.org; Tue, 19 Jul 2016 09:58:01 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE57D7D0E3; Tue, 19 Jul 2016 09:57:43 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-25.brq.redhat.com [10.40.204.25]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6J9vRUK021439; Tue, 19 Jul 2016 05:57:43 -0400 From: Sabrina Dubroca To: hostap@lists.infradead.org Subject: [PATCH 6/8] mka: avoid reading past the end of mka_body_handler Date: Tue, 19 Jul 2016 11:56:56 +0200 Message-Id: <30c1e3675b095e03b29e852e832637dba0f7233b.1467374899.git.sd@queasysnail.net> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 19 Jul 2016 09:57:43 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160719_025800_006932_41E3C6DF X-CRM114-Status: GOOD ( 10.82 ) X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.132.183.28 listed in wl.mailspike.net] -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [209.132.183.28 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sabrina Dubroca MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org body_type, used to index in mka_body_handler, can be any u8 value, but we have only ARRAY_SIZE(mka_body_handler) elements. Signed-off-by: Sabrina Dubroca --- src/pae/ieee802_1x_kay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pae/ieee802_1x_kay.c b/src/pae/ieee802_1x_kay.c index 5b4e05a25c61..4c050eb9866a 100644 --- a/src/pae/ieee802_1x_kay.c +++ b/src/pae/ieee802_1x_kay.c @@ -3053,7 +3053,8 @@ static int ieee802_1x_kay_decode_mkpdu(struct ieee802_1x_kay *kay, goto next_para_set; handled[body_type] = TRUE; - if (mak_body_handler[body_type].body_rx) { + if (body_type < ARRAY_SIZE(mak_body_handler) && + mak_body_handler[body_type].body_rx) { mak_body_handler[body_type].body_rx (participant, pos, left_len); } else {