From nobody Wed Dec 17 06:46:03 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4FAEC4332F for ; Tue, 12 Dec 2023 03:23:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345859AbjLLDXM (ORCPT ); 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?= 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/pe= rf/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 bufl= en) { if (code < 1 || code >=3D INTEL_PT_ERR_MAX) code =3D INTEL_PT_ERR_UNK; - strlcpy(buf, intel_pt_err_msgs[code], buflen); + strscpy(buf, intel_pt_err_msgs[code], buflen); return 0; } --=20 2.25.1