From: Nitin Joshi Date: Tue, 7 Jan 2025 02:15:07 +0000 (+0900) Subject: platform/x86: thinkpad-acpi: replace strcpy with strscpy X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=053c409951db96ca3043e568572b940a99d2464f;p=users%2Fjedix%2Flinux-maple.git platform/x86: thinkpad-acpi: replace strcpy with strscpy strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors.[1] [1]: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy Signed-off-by: Nitin Joshi Reviewed-by: Mark Pearson Link: https://lore.kernel.org/r/20250107021507.4786-1-nitjoshi@gmail.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen --- diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index f51662861738..22f871e9f53c 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -11681,7 +11681,7 @@ static int __init set_ibm_param(const char *val, const struct kernel_param *kp) if (strcmp(ibm->name, kp->name) == 0 && ibm->write) { if (strlen(val) > sizeof(ibms_init[i].param) - 1) return -ENOSPC; - strcpy(ibms_init[i].param, val); + strscpy(ibms_init[i].param, val); return 0; } }