aboutsummaryrefslogtreecommitdiff
path: root/include/linux/overflow.h
diff options
context:
space:
mode:
authorAzeem Shaikh <azeemshaikh38@gmail.com>2023-05-12 15:57:49 +0000
committerKees Cook <keescook@chromium.org>2023-05-22 12:34:41 -0700
commit8ca25e00cf817b635f4e80d59b6d07686d74eff0 (patch)
treee76d69eb0c39ac4a18970023949fe67b863d0367 /include/linux/overflow.h
parent30ad0627f169f56180e668e7223eaa43aa190a75 (diff)
downloadlinux-8ca25e00cf817b635f4e80d59b6d07686d74eff0.tar.gz
linux-8ca25e00cf817b635f4e80d59b6d07686d74eff0.tar.bz2
linux-8ca25e00cf817b635f4e80d59b6d07686d74eff0.zip
NFS: Prefer strscpy over strlcpy calls
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]. Check for strscpy()'s return value of -E2BIG on truncate for safe replacement with strlcpy(). This is part of a tree-wide cleanup to remove the strlcpy() function entirely from the kernel [2]. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [2] https://github.com/KSPP/linux/issues/89 Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20230512155749.1356958-1-azeemshaikh38@gmail.com
Diffstat (limited to 'include/linux/overflow.h')
0 files changed, 0 insertions, 0 deletions