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: <202211150847452601249@zte.com.cn>
Date:   Tue, 15 Nov 2022 08:47:45 +0800 (CST)
From:   <guo.ziliang@....com.cn>
To:     <gregkh@...uxfoundation.org>
Cc:     <tj@...nel.org>, <linux-kernel@...r.kernel.org>,
        <guo.ziliang@....com.cn>
Subject: [PATCH linux-next] kernfs: use strscpy() is more robust and safer

From: guo ziliang <guo.ziliang@....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: guo ziliang <guo.ziliang@....com.cn>
---
 fs/kernfs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 77d7a3a..fbb8df4 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -844,7 +844,7 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent,

        spin_lock_irq(&kernfs_pr_cont_lock);

-       len = strlcpy(kernfs_pr_cont_buf, path, sizeof(kernfs_pr_cont_buf));
+       len = strscpy(kernfs_pr_cont_buf, path, sizeof(kernfs_pr_cont_buf));

        if (len >= sizeof(kernfs_pr_cont_buf)) {
                spin_unlock_irq(&kernfs_pr_cont_lock);
--
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ