linux/net/tipc
Simon Horman 6555a2a921 tipc: guard against string buffer overrun
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 b97bf3fd8f ("[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>
2024-08-02 17:16:09 -07:00
..
addr.c
addr.h tipc: Remove unused function declarations 2023-08-03 12:51:45 +02:00
bcast.c
bcast.h
bearer.c tipc: guard against string buffer overrun 2024-08-02 17:16:09 -07:00
bearer.h tipc: Remove unused function declarations 2023-08-03 12:51:45 +02:00
core.c tipc: fix use-after-free Read in tipc_named_reinit 2022-06-17 11:39:10 +01:00
core.h tipc: Remove unused struct declaration 2024-07-12 03:41:32 +01:00
crypto.c tipc: fix a potential deadlock on &tx->lock 2023-10-04 13:24:12 -07:00
crypto.h
diag.c sock_diag: add module pointer to "struct sock_diag_handler" 2024-01-23 15:13:54 +01:00
discover.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
discover.h
eth_media.c
group.c
group.h
ib_media.c
Kconfig net: tipc: remove redundant 'bool' from CONFIG_TIPC_{MEDIA_UDP,CRYPTO} 2024-02-07 13:18:43 +00:00
link.c tipc: Consolidate redundant functions 2024-07-12 03:47:43 +01:00
link.h tipc: Remove unused declaration tipc_link_build_bc_sync_msg() 2023-08-09 13:03:14 -07:00
Makefile tipc: rename the module name diag to tipc_diag 2024-02-06 13:47:36 +01:00
monitor.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
monitor.h
msg.c tipc: fix a possible memleak in tipc_buf_append 2024-05-01 18:39:44 -07:00
msg.h
name_distr.c net/tipc: Remove unused struct distr_queue_item 2022-09-29 18:48:32 -07:00
name_distr.h tipc: Remove unused function declarations 2023-08-03 12:51:45 +02:00
name_table.c tipc: cleanup unused function 2022-06-17 11:43:57 +01:00
name_table.h tipc: cleanup unused function 2022-06-17 11:43:57 +01:00
net.c
net.h tipc: Remove unused function declarations 2023-08-03 12:51:45 +02:00
netlink_compat.c tipc: Remove redundant call to TLV_SPACE() 2023-11-17 02:27:27 +00:00
netlink.c tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING 2023-11-01 22:26:37 -07:00
netlink.h
node.c tipc: force a dst refcount before doing decryption 2024-06-18 15:08:57 +02:00
node.h
socket.c kernel-wide: fix spelling mistakes like "assocative" -> "associative" 2024-06-28 19:36:28 -07:00
socket.h
subscr.c
subscr.h
sysctl.c net: Remove ctl_table sentinel elements from several networking subsystems 2024-05-03 13:29:42 +01:00
topsrv.c net/sock: Introduce trace_sk_data_ready() 2023-01-23 11:26:50 +00:00
topsrv.h
trace.c
trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
udp_media.c tipc: Return non-zero value from tipc_udp_addr2str() on error 2024-07-24 12:18:03 +01:00
udp_media.h