mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-19 20:05:08 +00:00
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>
This commit is contained in:
parent
9d287e70c5
commit
9e1a6db68e
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user