Kees Cook a3bfc09506 tcp: Replace strncpy() with strscpy()
Replace the deprecated[1] uses of strncpy() in tcp_ca_get_name_by_key()
and tcp_get_default_congestion_control(). The callers use the results as
standard C strings (via nla_put_string() and proc handlers respectively),
so trailing padding is not needed.

Since passing the destination buffer arguments decays it to a pointer,
the size can't be trivially determined by the compiler. ca->name is
the same length in both cases, so strscpy() won't fail (when ca->name
is NUL-terminated). Include the length explicitly instead of using the
2-argument strscpy().

Link: https://github.com/KSPP/linux/issues/90 [1]
Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20240714041111.it.918-kees@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-07-16 07:52:15 -07:00
..
2024-05-01 18:37:07 -07:00
2024-05-08 10:39:26 +01:00
2024-04-30 18:32:38 -07:00
2024-01-04 10:23:10 -08:00
2024-04-30 18:46:52 -07:00
2021-05-17 15:29:35 -07:00
2024-06-06 11:52:52 +02:00
2022-12-20 03:13:45 +01:00
2024-06-12 06:39:04 +01:00
2023-09-14 16:16:36 +02:00