From nobody Thu Sep 18 20:24:27 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 CFD8FC352A1 for ; Sat, 3 Dec 2022 06:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231204AbiLCGVj (ORCPT ); Sat, 3 Dec 2022 01:21:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbiLCGVh (ORCPT ); Sat, 3 Dec 2022 01:21:37 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C1DDD1584 for ; Fri, 2 Dec 2022 22:21:32 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (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 4NPKT73psMz5BNS0; Sat, 3 Dec 2022 14:21:31 +0800 (CST) Received: from szxlzmapp06.zte.com.cn ([10.5.230.252]) by mse-fl1.zte.com.cn with SMTP id 2B36LQWv088639; Sat, 3 Dec 2022 14:21:26 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp02[null]) by mapi (Zmail) with MAPI id mid14; Sat, 3 Dec 2022 14:21:28 +0800 (CST) Date: Sat, 3 Dec 2022 14:21:28 +0800 (CST) X-Zmail-TransId: 2b04638aeae8607ffc88 X-Mailer: Zmail v1.0 Message-ID: <202212031421285953755@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIGFjY2Vzc2liaWxpdHk6IHNwZWFrdXA6IHVzZSBzdHJzY3B5KCkgdG8gaW5zdGVhZCBvZiBzdHJuY3B5KCk=?= X-MAIL: mse-fl1.zte.com.cn 2B36LQWv088639 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 638AEAEB.000 by FangMail milter! X-FangMail-Envelope: 1670048491/4NPKT73psMz5BNS0/638AEAEB.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 638AEAEB.000/4NPKT73psMz5BNS0 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: Xu Panda The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL terminated strings. Signed-off-by: Xu Panda Signed-off-by: Yang Yang --- drivers/accessibility/speakup/kobjects.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/accessibility/speakup/kobjects.c b/drivers/accessibili= ty/speakup/kobjects.c index a7522d409802..273c076b661a 100644 --- a/drivers/accessibility/speakup/kobjects.c +++ b/drivers/accessibility/speakup/kobjects.c @@ -426,8 +426,7 @@ static ssize_t synth_direct_store(struct kobject *kobj, spin_lock_irqsave(&speakup_info.spinlock, flags); while (len > 0) { bytes =3D min_t(size_t, len, 250); - strncpy(tmp, ptr, bytes); - tmp[bytes] =3D '\0'; + strscpy(tmp, ptr, bytes); string_unescape_any_inplace(tmp); synth_printf("%s", tmp); ptr +=3D bytes; --=20 2.15.2