]> Git Repo - linux.git/commit - fs/kernfs/dir.c
kernfs: Convert kernfs_walk_ns() from strlcpy() to strscpy()
authorKees Cook <[email protected]>
Tue, 12 Dec 2023 21:17:38 +0000 (13:17 -0800)
committerGreg Kroah-Hartman <[email protected]>
Fri, 15 Dec 2023 16:25:10 +0000 (17:25 +0100)
commit792e04768efbf2a1b49a7162a9fa06c1fa584723
tree8ec9ab11606dda974095e14ffefff12047ad374a
parent2678fd2fe9ee2c569e9cb6b17e786bc8f0753538
kernfs: Convert kernfs_walk_ns() from strlcpy() to strscpy()

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[1].
Additionally, it returns the size of the source string, not the
resulting size of the destination string. In an effort to remove strlcpy()
completely[2], replace strlcpy() here with strscpy().

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
Link: https://github.com/KSPP/linux/issues/89
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Azeem Shaikh <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
fs/kernfs/dir.c
This page took 0.050584 seconds and 4 git commands to generate.