* [PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer
@ 2017-05-23 23:25 Karim Eshapa
2017-05-24 14:15 ` Moore, Robert
0 siblings, 1 reply; 2+ messages in thread
From: Karim Eshapa @ 2017-05-23 23:25 UTC (permalink / raw)
To: robert.moore
Cc: lv.zheng, rafael.j.wysocki, lenb, linux-acpi, devel,
linux-kernel, Karim Eshapa
Use strlcpy with sized buffer instead of strncpy to
avoid non NUL-terminated source strings problems.
Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com>
---
drivers/acpi/acpica/dbfileio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/acpica/dbfileio.c b/drivers/acpi/acpica/dbfileio.c
index 4d81ea2..f0f22f1 100644
--- a/drivers/acpi/acpica/dbfileio.c
+++ b/drivers/acpi/acpica/dbfileio.c
@@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread* RE: [PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer
2017-05-23 23:25 [PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer Karim Eshapa
@ 2017-05-24 14:15 ` Moore, Robert
0 siblings, 0 replies; 2+ messages in thread
From: Moore, Robert @ 2017-05-24 14:15 UTC (permalink / raw)
To: Karim Eshapa
Cc: Zheng, Lv, Wysocki, Rafael J, lenb, linux-acpi, devel, linux-kernel
I'm not sure that strlcpy is portable.
Bob
> -----Original Message-----
> From: Karim Eshapa [mailto:karim.eshapa@gmail.com]
> Sent: Tuesday, May 23, 2017 4:26 PM
> To: Moore, Robert <robert.moore@intel.com>
> Cc: Zheng, Lv <lv.zheng@intel.com>; Wysocki, Rafael J
> <rafael.j.wysocki@intel.com>; lenb@kernel.org; linux-
> acpi@vger.kernel.org; devel@acpica.org; linux-kernel@vger.kernel.org;
> Karim Eshapa <karim.eshapa@gmail.com>
> Subject: [PATCH] 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.
>
> Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com>
> ---
> drivers/acpi/acpica/dbfileio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/acpica/dbfileio.c
> b/drivers/acpi/acpica/dbfileio.c index 4d81ea2..f0f22f1 100644
> --- a/drivers/acpi/acpica/dbfileio.c
> +++ b/drivers/acpi/acpica/dbfileio.c
> @@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-24 14:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23 23:25 [PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer Karim Eshapa
2017-05-24 14:15 ` Moore, Robert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®