From patchwork Thu Aug 22 14:54:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2848300 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D06FDBF546 for ; Thu, 22 Aug 2013 14:54:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD3E0205B5 for ; Thu, 22 Aug 2013 14:54:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 44C8A204E2 for ; Thu, 22 Aug 2013 14:54:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752967Ab3HVOyO (ORCPT ); Thu, 22 Aug 2013 10:54:14 -0400 Received: from mail-ee0-f42.google.com ([74.125.83.42]:62031 "EHLO mail-ee0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752778Ab3HVOyN (ORCPT ); Thu, 22 Aug 2013 10:54:13 -0400 Received: by mail-ee0-f42.google.com with SMTP id b45so833697eek.1 for ; Thu, 22 Aug 2013 07:54:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=rDXWlFELUomh5n952zX9nNI0CAINF8UDVj8LAFT7hF8=; b=lAoV3RC3WwsU8RE4pncv0O4AvgN4/Ncxs75Kdao5JO371dDR99ucfewSxcFv03nXM4 /yrw8skv7UnQD+ZJdvB65OSq7brLSMVPbj6X1QTIMGYRf14wXWQ1/1rLQKLZaLso6bBa ORxVPb25jF2lYfguM9Bi3S9cM9C2exYKFa4ynBErA7zdBc58WS4D6x1843ZFVQ3rU421 NeD5K6tA9l47Qo+zennVzeJA89aUq84apotXAafW4Cptn3zJl/MigtIka6C/ZJAr/ZtG Ti5oa7rh97uI93lvImpE32nDr3pPNQ2alXP2tfd4XjPFqxqpjtuOZPpmwaeC61v587vp +7gg== X-Gm-Message-State: ALoCoQloivNee184a6pF1ePt04fiICtoH2q6AQpDo6kssTFHJvoz8WWGCII5+syvPWUgfvY9bEyr X-Received: by 10.14.225.199 with SMTP id z47mr19512416eep.24.1377183252281; Thu, 22 Aug 2013 07:54:12 -0700 (PDT) Received: from [192.168.1.102] (c-98-229-118-119.hsd1.ma.comcast.net. [98.229.118.119]) by mx.google.com with ESMTPSA id j7sm8863375eeo.15.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Aug 2013 07:54:11 -0700 (PDT) Message-ID: <52162611.7050903@dev.mellanox.co.il> Date: Thu, 22 Aug 2013 10:54:09 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: Dan Ben-Yosef , Alex Netes Subject: [PATCH opensm] osm_helper.c: Fix out-of-bounds read Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dan Ben Yosef Overrunning static array "disp_msg_str", with 35 elements, at position 35 with index variable "msg". Signed-off-by: Dan Ben Yosef Signed-off-by: Alex Netes Signed-off-by: Hal Rosenstock --- opensm/osm_helper.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opensm/osm_helper.c b/opensm/osm_helper.c index d31d088..55f0637 100644 --- a/opensm/osm_helper.c +++ b/opensm/osm_helper.c @@ -2941,8 +2941,8 @@ static const char *disp_msg_str[] = { const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg) { - if (msg > OSM_MSG_MAX) - msg = OSM_MSG_MAX; + if (msg >= OSM_MSG_MAX) + msg = OSM_MSG_MAX-1; return disp_msg_str[msg]; }