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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm not sure that strlcpy is portable.
Bob


> -----Original Message-----
> From: Karim Eshapa [mailto:karim.eshapa@xxxxxxxxx]
> Sent: Tuesday, May 23, 2017 4:26 PM
> To: Moore, Robert <robert.moore@xxxxxxxxx>
> Cc: Zheng, Lv <lv.zheng@xxxxxxxxx>; Wysocki, Rafael J
> <rafael.j.wysocki@xxxxxxxxx>; lenb@xxxxxxxxxx; linux-
> acpi@xxxxxxxxxxxxxxx; devel@xxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> Karim Eshapa <karim.eshapa@xxxxxxxxx>
> 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@xxxxxxxxx>
> ---
>  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

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux