mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
btrfs: replace deprecated strncpy() with strscpy()
strncpy() is deprecated for NUL-terminated destination buffers. Use strscpy() instead and don't zero-initialize the param array. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5a4041f2c4
commit
2df2c6ed89
|
|
@ -1330,13 +1330,13 @@ MODULE_PARM_DESC(read_policy,
|
|||
|
||||
int btrfs_read_policy_to_enum(const char *str, s64 *value_ret)
|
||||
{
|
||||
char param[32] = { 0 };
|
||||
char param[32];
|
||||
char __maybe_unused *value_str;
|
||||
|
||||
if (!str || strlen(str) == 0)
|
||||
return 0;
|
||||
|
||||
strncpy(param, str, sizeof(param) - 1);
|
||||
strscpy(param, str);
|
||||
|
||||
#ifdef CONFIG_BTRFS_EXPERIMENTAL
|
||||
/* Separate value from input in policy:value format. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user