Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1225404pxb; Fri, 1 Apr 2022 07:52:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1aFj7UKAt5rcDHG+bSGpehTxnxfCSAj98tT+215z9yneplYH6XXAJSOoRtpz330tQk21U X-Received: by 2002:a05:6402:749:b0:419:2707:7495 with SMTP id p9-20020a056402074900b0041927077495mr21586442edy.317.1648824771197; Fri, 01 Apr 2022 07:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648824771; cv=none; d=google.com; s=arc-20160816; b=1CqyW+K2sBf7KU1KE4wcuSfhvdFDQ5pEjtf/TEvaHH7qcryA+DgYo0yX6tFhPgbLll zyHQkH/6MOEHoyimuG56Y2JT2fxi4td48cgS7RyFf6eGcNcMk2RoCI7p3N2kuLR/771Z qPk0G5gzXkNmR7AaTiCb6bYa+I9zcgJJexGNznD7qv+mQG1Rn8Fsb+YU3lF0MH9SvjDz yChBy+oxbM8Qf+tSQQUIEsm3EvQmyc4C+QzuF7/m4ah2rXpwdKgAFKSy7qxZ3DM6GWeb 8fvPGlF+j1gS5Fv31vu5VPSuntH3pNedeeFRVydjxOmk5pMyEDL8fmWBW8wSjsoeERo/ A8Ow== 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=sttgm5Xa4OfeCDeGYmIIMo90EQ+qh2ZV3D/YDscLzXtDQ9uucm3buMmQRyaGN1jlmH mlHyyx+mGKWMA6bVfr5Rc8UKNZcw4K3FRA0asDMVVkSjjncjVF2QzvuXlNUyvlZj+ZwK ZxH5+wmCficGiSpXulgjUWMq95tghUH68E6dp8ZITnK9Lv1ytasLcFJ1oMByt8RMH4Jt SF8cW9gs2hbwwUMgIEJOirUEhwb8w1njGu8WN3n8imATGkChHhKdrz2ePiUinL/NOFHD tvDQXFhd3+4ilI1nQzOx4HqqCgPEsApUTOJDoyTD18/t39vIVDlhAbVsQi0wamckiVva Bb2Q== 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 a18-20020a1709062b1200b006df846c75cesi1664326ejg.853.2022.04.01.07.52.16; Fri, 01 Apr 2022 07:52:51 -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 S1343558AbiDAKaA (ORCPT + 99 others); Fri, 1 Apr 2022 06:30:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343535AbiDAK34 (ORCPT ); Fri, 1 Apr 2022 06:29:56 -0400 Received: from mxout04.lancloud.ru (mxout04.lancloud.ru [45.84.86.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0BE126E57D for ; Fri, 1 Apr 2022 03:28:05 -0700 (PDT) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 66F6420CAB75 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Ildar Kamaletdinov To: CC: Ildar Kamaletdinov Subject: [PATCH BlueZ 2/7] tools: Fix buffer overflow in hciattach_tialt.c Date: Fri, 1 Apr 2022 13:27:52 +0300 Message-ID: <20220401102757.3960551-3-i.kamaletdinov@omp.ru> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401102757.3960551-1-i.kamaletdinov@omp.ru> References: <20220401102757.3960551-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: LFEXT01.lancloud.ru (fd00:f066::141) 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