acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer
Subsystems (2)
PATCH 1/1 acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer
Use strlcpy with sized buffer instead of strncpy to avoid non NUL-terminated source strings problems.
--- drivers/acpi/acpica/dbfileio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/dbfileio.c +1 -1
@@ -99,7 +99,7 @@ void acpi_db_open_debug_file(char *name) }acpi_os_printf ("Debug output file %s opened\n" , name); -strncpy (acpi_gbl_db_debug_filename, name, +strlcpy (acpi_gbl_db_debug_filename, name,sizeof (acpi_gbl_db_debug_filename)); acpi_gbl_db_output_to_file = TRUE; }
Signature · 1 line
2.7.4
I'm not sure that strlcpy is portable.
Bob
Quoted 34 lines
-----Original Message-----
From: Karim Eshapa [mailto:karim.eshapa(a)gmail.com]
Sent: Tuesday, May 23, 2017 4:26 PM
To: Moore, Robert <robert.moore(a)intel.com>
Cc: Zheng, Lv <lv.zheng(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; lenb(a)kernel.org; linux- acpi(a)vger.kernel.org; devel(a)acpica.org; linux-kernel(a)vger.kernel.org; Karim Eshapa <karim.eshapa(a)gmail.com>
Subject: [PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized bufferUse strlcpy with sized buffer instead of strncpy to avoid non NUL- terminated source strings problems.
Signed-off-by Karim Eshapa <karim.eshapa(a)gmail.com>--- drivers/acpi/acpica/dbfileio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/acpi/acpica/dbfileio.cindex 4d81ea2..f0f22f1 100644drivers/acpi/acpica/dbfileio.c +1
-2@@ -99,7 +99,7 @@ void acpi_db_open_debug_file(char *name) }acpi_os_printf ("Debug output file %s opened\n" , name); -strncpy (acpi_gbl_db_debug_filename, name, +strlcpy (acpi_gbl_db_debug_filename, name,sizeof (acpi_gbl_db_debug_filename)); acpi_gbl_db_output_to_file = TRUE; } --2.7.4