aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_user.c
diff options
context:
space:
mode:
authorDaniel Yang <[email protected]>2024-11-13 09:20:58 +0000
committerSteffen Klassert <[email protected]>2024-11-14 10:38:37 +0000
commit9e1a6db68e3ccc5c20fd2d6243285d1cc7215fe4 (patch)
treee9ba27d7659b37d90ed3a1019a4f8e20850f9342 /net/xfrm/xfrm_user.c
parentxfrm: Add error handling when nla_put_u32() returns an error (diff)
downloadkernel-9e1a6db68e3ccc5c20fd2d6243285d1cc7215fe4.tar.gz
kernel-9e1a6db68e3ccc5c20fd2d6243285d1cc7215fe4.zip
xfrm: replace deprecated strncpy with strscpy_pad
The function strncpy is deprecated since it does not guarantee the destination buffer is NULL terminated. Recommended replacement is strscpy. The padded version was used to remain consistent with the other strscpy_pad usage in the modified function. Signed-off-by: Daniel Yang <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
Diffstat (limited to 'net/xfrm/xfrm_user.c')
-rw-r--r--net/xfrm/xfrm_user.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index fab18b85af53..6b0800c7c75e 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1101,7 +1101,7 @@ static int copy_to_user_auth(struct xfrm_algo_auth *auth, struct sk_buff *skb)
if (!nla)
return -EMSGSIZE;
algo = nla_data(nla);
- strncpy(algo->alg_name, auth->alg_name, sizeof(algo->alg_name));
+ strscpy_pad(algo->alg_name, auth->alg_name, sizeof(algo->alg_name));
if (redact_secret && auth->alg_key_len)
memset(algo->alg_key, 0, (auth->alg_key_len + 7) / 8);