Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fujitsu-laptop: replace strcpy -> 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: Abdul Rahim <abdul.rahim@myyahoo.com>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Link: https://lore.kernel.org/r/20241127203710.36425-1-abdul.rahim@myyahoo.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Abdul Rahim and committed by
Ilpo Järvinen
0ffafd4a 6e0fb1bd

+4 -4
+4 -4
drivers/platform/x86/fujitsu-laptop.c
··· 505 505 return -ENOMEM; 506 506 507 507 fujitsu_bl = priv; 508 - strcpy(acpi_device_name(device), ACPI_FUJITSU_BL_DEVICE_NAME); 509 - strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS); 508 + strscpy(acpi_device_name(device), ACPI_FUJITSU_BL_DEVICE_NAME); 509 + strscpy(acpi_device_class(device), ACPI_FUJITSU_CLASS); 510 510 device->driver_data = priv; 511 511 512 512 pr_info("ACPI: %s [%s]\n", ··· 891 891 WARN_ONCE(fext, "More than one FUJ02E3 ACPI device was found. Driver may not work as intended."); 892 892 fext = device; 893 893 894 - strcpy(acpi_device_name(device), ACPI_FUJITSU_LAPTOP_DEVICE_NAME); 895 - strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS); 894 + strscpy(acpi_device_name(device), ACPI_FUJITSU_LAPTOP_DEVICE_NAME); 895 + strscpy(acpi_device_class(device), ACPI_FUJITSU_CLASS); 896 896 device->driver_data = priv; 897 897 898 898 /* kfifo */