Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4393784rdb; Mon, 11 Dec 2023 19:23:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkeh3KVhu8oL1aG1NH0O9CtZi3KRvi1W1SBGM8zLwuGT9s1+8pQxepFtRDd000rTtZ3Nuz X-Received: by 2002:a92:cdaf:0:b0:35d:7812:6fee with SMTP id g15-20020a92cdaf000000b0035d78126feemr6938921ild.16.1702351406479; Mon, 11 Dec 2023 19:23:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702351406; cv=none; d=google.com; s=arc-20160816; b=GZ6wvgf8A7gerlR9Gd1vaFCAa0PK1FobTWkGEogvJvlo2qGLFM6psO5HkEWYurm5zc RPociIfw9QdCeQnWDOgy3UY3ltQ5uV+CYPR5lCpOWlnOh0RkdrzntdhZ5hcHqopKl1EM 3PF/C89BsJoTQRV9zw1NvhXWc9wDKQt81wDBDiGnOi601jiH513s7ZivezFmmNzMjtkM u7NGw/qMl6XiZINooxvu/2KUt9VX+g+liA1m2siIVHiLqlaAp5Z3E1dchkSUOPIz4ZfB 2tZ7J20l5hjMhSs7H9DChA6qWmg3ZfbfTKHiMolJSws1KkmGVQDvSuKsnwOrvHrPMrPQ sWKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=CXQ4Q8CPpjPZlRW2enVZ5rfLlNARTlk611R0fl7vsf0=; fh=NgRHcNy3DgtHmOKu9ssjWAG4njg0wYnS3Xp9T5VRZ74=; b=r8MIapkSZNzBerPLjl+l/V/DSR7fvdT/d/FdU4rPwsB3DwvuqXynHRWIvB8mneGGu/ g4pvhfyYAlPxJubBxKeKGDKoIszAsIeYfvw1yhCiFjomeHG8oMcrGSsrYFMXfscH0MnD lpMXpD3VPUUL525tI1emS50yD8/4fUN9KgMTAXidTAHtJh98+cZimzHGXXXoxA5qVQIq lqDpugr8gwmg1l23BVSs59zJ/N16i03Nyp4dfaWmcTMksov3GbH3qU+lTTq3/3Md4FeE b5oSx5ycxj0vVeipMrkWW/r1fRRKtlXO1Ba2Lsye/7iIhFV0zM+R1G4aP1woXrtI5/9c i8nA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id n185-20020a6327c2000000b005c65bbc7951si7127870pgn.496.2023.12.11.19.23.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 19:23:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 57B91805090B; Mon, 11 Dec 2023 19:23:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345854AbjLLDXM (ORCPT + 99 others); Mon, 11 Dec 2023 22:23:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345805AbjLLDXL (ORCPT ); Mon, 11 Dec 2023 22:23:11 -0500 X-Greylist: delayed 152 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 11 Dec 2023 19:23:16 PST Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F9DFA6 for ; Mon, 11 Dec 2023 19:23:16 -0800 (PST) Received: from mxct.zte.com.cn (unknown [192.168.251.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4Sq3pm5r75z8XrRC; Tue, 12 Dec 2023 11:23:12 +0800 (CST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4Sq3pd2xBtz4xVbv; Tue, 12 Dec 2023 11:23:05 +0800 (CST) Received: from xaxapp02.zte.com.cn ([10.88.97.241]) by mse-fl2.zte.com.cn with SMTP id 3BC3Mtte091763; Tue, 12 Dec 2023 11:22:55 +0800 (+08) (envelope-from yang.guang5@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Tue, 12 Dec 2023 11:22:56 +0800 (CST) Date: Tue, 12 Dec 2023 11:22:56 +0800 (CST) X-Zmail-TransId: 2af96577d2100ce-8cd53 X-Mailer: Zmail v1.0 Message-ID: <202312121122562881958@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIHBlcmYgaW50ZWwtcHQ6IHJlcGxhY2Ugc3RybGNweSgpIHdpdGggc3Ryc2NweSgp?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 3BC3Mtte091763 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6577D220.000/4Sq3pm5r75z8XrRC X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 11 Dec 2023 19:23:24 -0800 (PST) From: Yang Guang strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated. No return values were used, so direct replacement is safe. Signed-off-by: Chen Haonan --- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c index b450178e3420..5b14c6701ecb 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c @@ -507,7 +507,7 @@ int intel_pt__strerror(int code, char *buf, size_t buflen) { if (code < 1 || code >= INTEL_PT_ERR_MAX) code = INTEL_PT_ERR_UNK; - strlcpy(buf, intel_pt_err_msgs[code], buflen); + strscpy(buf, intel_pt_err_msgs[code], buflen); return 0; } -- 2.25.1