summaryrefslogtreecommitdiff
path: root/net/tipc/link.c
diff options
context:
space:
mode:
authorKevin Paul Reddy Janagari <kevinpaul468@gmail.com>2025-04-11 14:20:10 +0530
committerPaolo Abeni <pabeni@redhat.com>2025-04-15 13:37:14 +0200
commit8c9b406ff470a8346232eec979dc84f518aabfd9 (patch)
tree0f4475ef2f78d4fc2c02c1ea5351569529a0d36b /net/tipc/link.c
parent4c2e0b00b51f2e4647d3285910ed28ab703dab1a (diff)
tipc: Removing deprecated strncpy()
This patch suggests the replacement of strncpy with strscpy as per Documentation/process/deprecated. The strncpy() fails to guarantee NULL termination, The function adds zero pads which isn't really convenient for short strings as it may cause performance issues. strscpy() is a preferred replacement because it overcomes the limitations of strncpy mentioned above. Compile Tested Signed-off-by: Kevin Paul Reddy Janagari <kevinpaul468@gmail.com> Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech> Tested-by: Tung Nguyen <tung.quang.nguyen@est.tech> Link: https://patch.msgid.link/20250411085010.6249-1-kevinpaul468@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 18be6ff4c3db..3ee44d731700 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2228,7 +2228,7 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
break;
if (msg_data_sz(hdr) < TIPC_MAX_IF_NAME)
break;
- strncpy(if_name, data, TIPC_MAX_IF_NAME);
+ strscpy(if_name, data, TIPC_MAX_IF_NAME);
/* Update own tolerance if peer indicates a non-zero value */
if (tipc_in_range(peers_tol, TIPC_MIN_LINK_TOL, TIPC_MAX_LINK_TOL)) {