lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202212031421285953755@zte.com.cn>
Date:   Sat, 3 Dec 2022 14:21:28 +0800 (CST)
From:   <yang.yang29@....com.cn>
To:     <w.d.hubbs@...il.com>
Cc:     <chris@...-brannons.com>, <kirk@...sers.ca>,
        <samuel.thibault@...-lyon.org>, <mushi.shar@...il.com>,
        <speakup@...ux-speakup.org>, <linux-kernel@...r.kernel.org>,
        <xu.panda@....com.cn>, <yang.yang29@....com.cn>
Subject: [PATCH linux-next] accessibility: speakup: use strscpy() to instead of strncpy()

From: Xu Panda <xu.panda@....com.cn>

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 <xu.panda@....com.cn>
Signed-off-by: Yang Yang <yang.yang29@....com>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ