Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1215021pxb; Fri, 1 Apr 2022 07:35:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3rqHkOhGuJX0h9xA1nDXJXKyF0lr1pTuFwmKPQru3UKVuBIHRrd281OfWOhXUT6J1Ae3d X-Received: by 2002:a17:907:2ce6:b0:6df:a489:d2e1 with SMTP id hz6-20020a1709072ce600b006dfa489d2e1mr126771ejc.264.1648823728502; Fri, 01 Apr 2022 07:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648823728; cv=none; d=google.com; s=arc-20160816; b=nGOLpDQUehBKgeXJVtWjzh8WkMZ4+yhFE6FrpWNRoFHoWwGF+es5tWLOSOh3yc+TF/ JnVVj6MMhz2ckic+iI0tN9dE2VU9FpriRcMPZuqaSCwCeUoMevP4e2JmIReC0n7Tq0/4 dcZsF77ZvhF4qlRp3BuwW0G73L8AsX4WHGbolyyfz9A/Eg/EbeFYDbHD9BFYJ7Vv0VsT bGGZXRle4ltZjr2rC71Z6Q/y0sHa3Yd0l4NRljE7eXQMPnzZkEG94S1v0OYU2llxEy1y I1uWiGjvONAIkgfoeozBwuPJftQispKdYVq3cSgPFA++PwsbdyxNqnTs6uikTpzDA4UF f54Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-filter; bh=uH5Ujayp04qT4lsbp2WljxA0NzUK0wIBPAzLx+UdJsU=; b=PGuC7VlieQ+RGK2ScBGgmRHn/L21S50/nK0A/wpuXdObzM/xnj/7DVoKPd/2pSsA7w N+hEJ05VPOT/9xqFAqwEYsXonm3pcDtE1zfUPgrsSBlFzBdPAup8TZAvEdLz7zWlUfRp 426YbP/Gh7Sy5OWYg1JNQN2MZaeHKpWeWmaDA1m0v6p9814zpThGiPm9+hzvJS5gtmXy tutsk5tr3qhGY9/qsJ5B/X4o1ygifTPlLWaphlKpltUUNPNzsaigorg1XWigKzbCB2QY dRPHdHIZTmQZSSeDNV3ukKMey3Br67W4Y282KMn0mFfUAm1YHNFg4I44QTtGIZWSoRdA 5DRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j10-20020a05640211ca00b00418f0c27a1csi2099619edw.158.2022.04.01.07.35.01; Fri, 01 Apr 2022 07:35:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235252AbiDAMSo (ORCPT + 99 others); Fri, 1 Apr 2022 08:18:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241747AbiDAMSn (ORCPT ); Fri, 1 Apr 2022 08:18:43 -0400 Received: from mxout04.lancloud.ru (mxout04.lancloud.ru [45.84.86.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FB29277967 for ; Fri, 1 Apr 2022 05:16:52 -0700 (PDT) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 1B75120D309E Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Ildar Kamaletdinov To: CC: Ildar Kamaletdinov Subject: [PATCH BlueZ 2/6] tools: Fix buffer overflow in hciattach_tialt.c Date: Fri, 1 Apr 2022 15:16:43 +0300 Message-ID: <20220401121647.3985682-3-i.kamaletdinov@omp.ru> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401121647.3985682-1-i.kamaletdinov@omp.ru> References: <20220401121647.3985682-1-i.kamaletdinov@omp.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1910.lancloud.ru (fd00:f066::80) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Array 'c_brf_chip' of size 8 could be accessed by index > 7. We should limit array access like in previous check at line 221. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. --- tools/hciattach_tialt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/hciattach_tialt.c b/tools/hciattach_tialt.c index 520b383a1..4f7fd42a3 100644 --- a/tools/hciattach_tialt.c +++ b/tools/hciattach_tialt.c @@ -221,7 +221,8 @@ int texasalt_init(int fd, int speed, struct termios *ti) ((brf_chip > 7) ? "unknown" : c_brf_chip[brf_chip]), brf_chip); - sprintf(fw, "/etc/firmware/%s.bin", c_brf_chip[brf_chip]); + sprintf(fw, "/etc/firmware/%s.bin", + (brf_chip > 7) ? "unknown" : c_brf_chip[brf_chip]); texas_load_firmware(fd, fw); texas_change_speed(fd, speed); -- 2.35.1