[PATCH] platform/x86: surfacepro3_button: replace deprecated strcpy() with strscpy()
From: Miguel García
Date: Thu Jul 24 2025 - 03:45:51 EST
strcpy() is deprecated for NUL-terminated strings. Replace it with
strscpy() to guarantee NUL-termination. 'name' is a fixed-size local
buffer.
Signed-off-by: Miguel García <miguelgarciaroman8@xxxxxxxxx>
---
drivers/platform/surface/surfacepro3_button.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platform/surface/surfacepro3_button.c
index 2755601f979c..9616548283a1 100644
--- a/drivers/platform/surface/surfacepro3_button.c
+++ b/drivers/platform/surface/surfacepro3_button.c
@@ -211,7 +211,7 @@ static int surface_button_add(struct acpi_device *device)
}
name = acpi_device_name(device);
- strcpy(name, SURFACE_BUTTON_DEVICE_NAME);
+ strscpy(name, SURFACE_BUTTON_DEVICE_NAME, sizeof(name));
snprintf(button->phys, sizeof(button->phys), "%s/buttons", hid);
input->name = name;
--
2.34.1