Azeem Shaikh 6b0adfafb0 crypto: lrw,xts - Replace strlcpy with strscpy
[ Upstream commit babb80b3ecc6f40c962e13c654ebcd27f25ee327 ]

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].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().

Direct replacement is safe here since return value of -errno
is used to check for truncation instead of sizeof(dest).

[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: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-23 11:09:55 +02:00
..
2020-08-28 16:58:28 +10:00
2021-03-26 19:55:55 +11:00
2021-05-28 15:11:47 +08:00
2023-03-10 09:39:11 +01:00
2022-08-17 14:24:19 +02:00
2022-08-17 14:24:19 +02:00
2020-02-28 08:43:21 +08:00
2023-03-10 09:39:11 +01:00
2021-08-21 15:44:58 +08:00
2021-06-11 15:03:30 +08:00