mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
keys: Replace strcpy(derived_buf, "AUTH_KEY") with strscpy(..., HASH_SIZE)
derived_buf is guaranteed to be HASH_SIZE - and it is more than enough. The strscpy() degenerates into an memcpy() (as did the strcpy()). Do the same for the associated "ENC_KEY" copy. Removes a possibly unbounded strcpy(). Signed-off-by: David Laight <david.laight.linux@gmail.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Link: https://lore.kernel.org/r/20260606202633.5018-9-david.laight.linux@gmail.com Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
This commit is contained in:
parent
c1201b37f6
commit
44b9597fea
|
|
@ -343,9 +343,9 @@ static int get_derived_key(u8 *derived_key, enum derived_key_type key_type,
|
|||
return -ENOMEM;
|
||||
|
||||
if (key_type)
|
||||
strcpy(derived_buf, "AUTH_KEY");
|
||||
strscpy(derived_buf, "AUTH_KEY", HASH_SIZE);
|
||||
else
|
||||
strcpy(derived_buf, "ENC_KEY");
|
||||
strscpy(derived_buf, "ENC_KEY", HASH_SIZE);
|
||||
|
||||
memcpy(derived_buf + strlen(derived_buf) + 1, master_key,
|
||||
master_keylen);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user