Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1648999 > unrolled thread

[PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer

Started byKarim Eshapa <karim.eshapa@gmail.com>
First post2017-05-24 01:30 +0200
Last post2017-05-24 16:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer Karim Eshapa <karim.eshapa@gmail.com> - 2017-05-24 01:30 +0200
    RE: [PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string  into a sized buffer "Moore, Robert" <robert.moore@intel.com> - 2017-05-24 16:20 +0200

#1648999 — [PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer

FromKarim Eshapa <karim.eshapa@gmail.com>
Date2017-05-24 01:30 +0200
Subject[PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer
Message-ID<tKrpw-1YV-3@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1649655 — RE: [PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer

From"Moore, Robert" <robert.moore@intel.com>
Date2017-05-24 16:20 +0200
SubjectRE: [PATCH] acpi: acpica: dbfileio: Use strlcpy to Copy a C-string into a sized buffer
Message-ID<tKFiO-3ph-7@gated-at.bofh.it>
In reply to#1648999
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web