platform/x86: thinkpad-acpi: replace strcpy with strscpy
PATCH 1/1 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
--- drivers/platform/x86/thinkpad_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +1 -1
@@ -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 ; } }
Signature · 1 line
2.43.0
Hi Nitin,
Quoted 25 lines · Nitin Joshi
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 <[email protected]>--- drivers/platform/x86/thinkpad_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/platform/x86/thinkpad_acpi.c +1
-1@@ -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 ; }
Quoted 3 lines
}
Signature · 1 line
2.43.0
Looks good to me.
Mark
Ilpo Järvinen
maintainerQuoted 8 lines · Nitin Joshi
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
[...]
Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86: thinkpad-acpi: replace strcpy with strscpy
commit: c9a90d746c09e61b1acb829d93f8283e296563fd
--
i.