kernel_samsung_a53x/net/tipc
Simon Horman ff9d241811 tipc: guard against string buffer overrun
[ Upstream commit 6555a2a9212be6983d2319d65276484f7c5f431a ]

Smatch reports that copying media_name and if_name to name_parts may
overwrite the destination.

 .../bearer.c:166 bearer_name_validate() error: strcpy() 'media_name' too large for 'name_parts->media_name' (32 vs 16)
 .../bearer.c:167 bearer_name_validate() error: strcpy() 'if_name' too large for 'name_parts->if_name' (1010102 vs 16)

This does seem to be the case so guard against this possibility by using
strscpy() and failing if truncation occurs.

Introduced by commit b97bf3fd8f6a ("[TIPC] Initial merge")

Compile tested only.

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240801-tipic-overrun-v2-1-c5b869d1f074@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:21:38 +01:00
..
addr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
addr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcast.c net: tipc: avoid possible garbage value 2024-11-23 23:21:19 +01:00
bcast.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bearer.c tipc: guard against string buffer overrun 2024-11-23 23:21:38 +01:00
bearer.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
core.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crypto.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crypto.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
diag.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
discover.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
discover.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
eth_media.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
group.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
group.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ib_media.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
link.c tipc: Use size_add() in calls to struct_size() 2024-11-18 11:42:47 +01:00
link.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
monitor.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
monitor.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
msg.c tipc: fix UAF in error path 2024-11-19 11:32:48 +01:00
msg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
name_distr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
name_distr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
name_table.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
name_table.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
net.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
net.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netlink.c tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING 2024-11-18 11:43:07 +01:00
netlink.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netlink_compat.c tipc: Fix kernel-infoleak due to uninitialized TLV value 2024-11-18 11:43:19 +01:00
node.c tipc: force a dst refcount before doing decryption 2024-11-19 14:19:08 +01:00
node.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
socket.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
socket.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
subscr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
subscr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sysctl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
topsrv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
topsrv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp_media.c tipc: Return non-zero value from tipc_udp_addr2str() on error 2024-11-23 23:20:17 +01:00
udp_media.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00