Re: [PATCH] NFS: Prefer strscpy over strlcpy calls
From: Kees Cook
Date: Mon May 22 2023 - 15:40:20 EST
On Fri, 12 May 2023 15:57:49 +0000, Azeem Shaikh wrote:
> 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().
>
> [...]
Applied to for-next/hardening, thanks!
[1/1] NFS: Prefer strscpy over strlcpy calls
https://git.kernel.org/kees/c/8ca25e00cf81
--
Kees Cook