Skip to content

Commit 9e1a6db

Browse files
danieltherealyangklassert
authored andcommitted
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 <danielyangkang@gmail.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent 9d287e7 commit 9e1a6db

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/xfrm/xfrm_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ static int copy_to_user_auth(struct xfrm_algo_auth *auth, struct sk_buff *skb)
11011101
if (!nla)
11021102
return -EMSGSIZE;
11031103
algo = nla_data(nla);
1104-
strncpy(algo->alg_name, auth->alg_name, sizeof(algo->alg_name));
1104+
strscpy_pad(algo->alg_name, auth->alg_name, sizeof(algo->alg_name));
11051105

11061106
if (redact_secret && auth->alg_key_len)
11071107
memset(algo->alg_key, 0, (auth->alg_key_len + 7) / 8);

0 commit comments

Comments
 (0)