net: Replace strlcpy with strscpy
authorAzeem Shaikh <azeemshaikh38@gmail.com>
Mon, 3 Jul 2023 17:58:40 +0000 (17:58 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Jul 2023 18:40:16 +0000 (19:40 +0100)
commitba7bdec3cbec7b0135f7ec0458073cbe9ae74de5
treebbb0dc5af2371242ac839a5078b51920ec34bbb2
parent84bef5b6037c15180ef88ac4216dc621d16df1a6
net: Replace strlcpy with 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].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().
No return values were used, so direct replacement is safe.

[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: Simon Horman <simon.horman@corigine.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/trace/events/fib.h
include/trace/events/fib6.h