Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1216294pxb; Fri, 1 Apr 2022 07:37:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuJRtBsYHAwTOLJlSJYIW0yelC/ubmPDcrHFL9mg569lgjFHwFIuzJBG/OETiAJ3zFC6Ab X-Received: by 2002:a05:6402:51cf:b0:419:63e2:2b96 with SMTP id r15-20020a05640251cf00b0041963e22b96mr21571455edd.336.1648823852658; Fri, 01 Apr 2022 07:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648823852; cv=none; d=google.com; s=arc-20160816; b=OVM8mET5nZnPTK6RzC9Tw50HR+g98ZYiQUHfQIhM8IQRsDEN3n3Kcb8Z7pcGz/Gv0/ +jYuk7VgL5s2QaGJ7jb5R3CNG8QPs1298yfOHDPsB1cqVBZfrm6MXVZOnlxM3e21VKAu wv63Z6ppE//yQ4N1iD9MpWjMxkPUPfs+g4k2IhWvi8YtuehObYiJmOjyUQe2cENPVfmP XHFd58FwYXtCA3nes61K3wJvJrUt5Aifyh9yrgZBmNaqsJgmaPKdUuSViO+u9P3cQMmX U4HJj2+Fi6twNpU7xwrLt4VLzBzOdn2qTDGCmuqQzW+nSuhjkAHwiCzGQFMftjknH/Vg pfog== 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=folozaGzkXIuyqatJSrTTD7S+oYNJjFk8ZPNNc8BcddYxLZ59lgiq/rsNb893GoJaR Llhbm5JLb3wwx7LlCKdJc7Rm5HrQwwOA67dg2pmfBWFS5teT8h2S1RrgGD4c5qgh0Q/E QEi2bE+L2tJZemVsyJvoCTrKpxFm6HX/wiAFbvdA/khx/51YONsnvtMYVbAH28cUSXNe vGQwwGj7rqfw5VmtJN7MjYLb8VVi+2+GOB4hHB+BhVTWiSUkYtBxuGeeWnqXR1UsENLR FJat+Beh0HODz94bmIkqG67svAdNflaHdkdsEmAWxwcSp0sWmCttO/cb0urklrODsIe+ QJpQ== 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 og12-20020a1709071dcc00b006e00eb3a62bsi1508527ejc.101.2022.04.01.07.37.06; Fri, 01 Apr 2022 07:37:32 -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 S1345364AbiDALQJ (ORCPT + 99 others); Fri, 1 Apr 2022 07:16:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237488AbiDALQJ (ORCPT ); Fri, 1 Apr 2022 07:16:09 -0400 Received: from mxout01.lancloud.ru (mxout01.lancloud.ru [45.84.86.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70BE6120DBC for ; Fri, 1 Apr 2022 04:14:16 -0700 (PDT) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru 9114820D48FB 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 14:14:03 +0300 Message-ID: <20220401111408.3961844-3-i.kamaletdinov@omp.ru> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401111408.3961844-1-i.kamaletdinov@omp.ru> References: <20220401111408.3961844-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