Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1209120pxb; Fri, 1 Apr 2022 07:26:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcp4m3noRW5BvKs5p1rwzR7m6JCCTq+Xexo7TbXGf+ypBNjAQr/Aioo7+XVeZPXsoObINM X-Received: by 2002:a17:90a:31cf:b0:1c9:f9b8:68c7 with SMTP id j15-20020a17090a31cf00b001c9f9b868c7mr12347864pjf.34.1648823200546; Fri, 01 Apr 2022 07:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648823200; cv=none; d=google.com; s=arc-20160816; b=hKDwwFHJsJjNVrU5z5vFPcB1uDF4kGlSnHy+bRmvUwrF7PaAr+rj3wJZKjbLF8N0d0 X0S0aiFg01HdrSr0M2treZkvcl3QooMhg5SdgjNxa2KbUe488qVJJj+DpTiuodJzWa7M un+M7EvTT8qqyd4d7V+CF8bwHmjsYu2e+0bf1ryqFQZtk8XFFR1CAbmiBT7HneINNDnH lGiIcv45HKCqA02r46ZqpkzHEecOtoc+c3fhKJFhYYnWxsMH4/Jn5UdRv7OqE/t0Skmx hH9s0CyWkJou9V0kLNqbqDqXtbQAY0HwPZwV4sCXy5troQ/P3Sx22Nf/BM1kxbdce2vX o/nw== 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=EZDcpDWywTyVJ2NE3qgP4XIVA/eToDtDk8v6dk1Vl6g=; b=CYAaG4KtFPkr3pD3Ge2gfbzjNyGeBCYUEyhqsuIRfGW3/opQJK52iYrHWX2H3s6AXL KHRpiDjVxXGpVjZb74FMbpQww+8Na7upiAPnlnTykVUQLO+tkIoMmC+dSZXscmiDJpIo Rmet789F1Efiti5/zsu6qFGiYYueiIGUeRaeh3ZUHqA+luGDLtApLGiSiG6x+OSPFiPv JP4tZDqWRbhS0oRTaK8laeDUgzUVg4Y1NCfsx9lvaMfNgIbnLOPQAwjDFu745Vj4DyAH 5RbgBMhal1hFKBbIu7Y5CeEtDxVBt6I9zCJkgfuTllkSruQZ/GML5M8kM1jh5QHd+u/d Uunw== 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 r10-20020a63fc4a000000b003816043f119si2487543pgk.782.2022.04.01.07.26.14; Fri, 01 Apr 2022 07:26:40 -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 S1343944AbiDAHsp (ORCPT + 99 others); Fri, 1 Apr 2022 03:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343946AbiDAHso (ORCPT ); Fri, 1 Apr 2022 03:48:44 -0400 Received: from mxout04.lancloud.ru (mxout04.lancloud.ru [45.84.86.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E9C425F655 for ; Fri, 1 Apr 2022 00:46:51 -0700 (PDT) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 0E1C520C1DE4 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 10:46:35 +0300 Message-ID: <20220401074640.3956695-3-i.kamaletdinov@omp.ru> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401074640.3956695-1-i.kamaletdinov@omp.ru> References: <20220401074640.3956695-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.34.0