Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3145527rwb; Fri, 2 Dec 2022 23:11:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf5F9vpY6Iz0CVwvyjSqQloxtrAzH5yXFHmnStXljokVrnVhiJL2GFSDdbn/kzs8+RMgQxP8 X-Received: by 2002:a17:907:2904:b0:78d:b598:bb6a with SMTP id eq4-20020a170907290400b0078db598bb6amr48952276ejc.258.1670051500572; Fri, 02 Dec 2022 23:11:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670051500; cv=none; d=google.com; s=arc-20160816; b=vw4xajOtnpcNsxigYwSZqtmu6iNjte4Holng+ID2ocpH9rJd/MzMLjwRFuibIcCWty 4cX6IoYHPfIX8Q2L+Cde69/8bidkdNbzemc+QTc9qx7TNc35etRNs7SHRmJU78S3zo8C ymi7uF/6osX0imEQv2Hl68/q1u8k5mJh5Nw9n8YAyixGmb3V9CErDoTO323udTl09o7Z zGlBpTaNx2eUH7zb2zbcTQvWkjhz6GcD27V7hjDd3M671nYiQGCCSgF2sF8HmWYsBEXK meFs2rgSjKs7OuY3fhEIVs5Ka9w6EthgA8PzkwjwnkRMpBfZIEztIUKM7jmR2EuuM1Lq 9gZA== 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=+Lxtytf1smZ9k3nHXMyDnnCKyLnobVwQKRZ8886najI=; b=mt5ZcU/AiOJUkMzhfIuFFmUeF602Qxyiqv9ek6nxatvrPXRpKt22CQveT8Aw7aCLqg U8hhQ3jKV7oW7cQ7kAFCTNrF4TqXcNpUd6GviMqSIwCGpHvJI9g2FbahY0YVLSF1kqbP 60TOH6yLwMmHnLjef8lPOEYskYovgy/fQptDn79fphO3m4WvtZX3Oa3IjydxfYBh53MK SwuC6NX4BiXiJQhgFqndPzm5lHOZHS65Bir+Zx+UuSkrHHS2sBXoe6nk1kc6ETuSF2t6 IOHC894s8iL6uVtGkH+sEVtrAW1qY/i3MCjItuXgutkXAJVxIgI+jcWyWzTJ5Xsld1uU 7rHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji18-20020a170907981200b007af039d0bd0si8039939ejc.404.2022.12.02.23.11.20; Fri, 02 Dec 2022 23:11:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230273AbiLCGVj (ORCPT + 83 others); 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=?= Content-Type: text/plain; charset="UTF-8" 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,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-kernel@vger.kernel.org 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/accessibility/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 = min_t(size_t, len, 250); - strncpy(tmp, ptr, bytes); - tmp[bytes] = '\0'; + strscpy(tmp, ptr, bytes); string_unescape_any_inplace(tmp); synth_printf("%s", tmp); ptr += bytes; -- 2.15.2