Skip to contentSkip to conversation

Updating a vulnerable use of strcpy.

PATCH Superseded Muhammad Qasim Abdul Majeed 1 participant 1 message Jun 30, 2024 ACPI

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Updating a vulnerable use of strcpy.

Replacing strcpy with strscpy with memory bound.

---
 drivers/acpi/acpi_video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpi_video.c +2 -2
index 1fda30388297..700f0e8fdba2 100644
@@ -1128,8 +1128,8 @@ static int acpi_video_bus_get_one_device(struct acpi_device *device, void *arg)
 		return -ENOMEM;
 	}
 
-	strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
-	strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
+	strscpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME, strlen(ACPI_VIDEO_DEVICE_NAME));
+	strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS, strlen(ACPI_VIDEO_CLASS));
 
 	data->device_id = device_id;
 	data->video = video;
Signature · 1 line
2.34.1