diff options
author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-02-26 02:21:27 +0300 |
---|---|---|
committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2025-03-03 15:57:32 +0300 |
commit | baa18b6ed4200aff869e78f2650123572b6a9ad6 (patch) | |
tree | c631c32627f9ede4a952816366188ad5b0f2f6a9 | |
parent | 0b6d8f9d2df78116afb159df05bbccf13a51b758 (diff) | |
download | linux-baa18b6ed4200aff869e78f2650123572b6a9ad6.tar.xz |
platform/x86: hp-bioscfg: Replace deprecated strncpy() with strscpy()
Since kstrtol() requires a NUL-terminated string as input and strncpy()
is deprecated for NUL-terminated destination buffers, use strscpy()
instead.
Compile-tested only.
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250225232126.356274-2-thorsten.blum@linux.dev
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-rw-r--r-- | drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c index 63c78b4d8258..13237890fc92 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c +++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c @@ -445,7 +445,7 @@ int hp_convert_hexstr_to_str(const char *input, u32 input_len, char **str, int * return -ENOMEM; for (i = 0; i < input_len; i += 5) { - strncpy(tmp, input + i, strlen(tmp)); + strscpy(tmp, input + i); if (kstrtol(tmp, 16, &ch) == 0) { // escape char if (ch == '\\' || |