
On Tue, Apr 07, 2020 at 08:57:24PM -0600, Simon Glass wrote:
On Fri, 3 Apr 2020 at 05:35, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
On Mon, Mar 30, 2020 at 05:12:48PM -0600, Simon Glass wrote:
...
strncpy(out_name, name, ACPI_NAME_MAX);
memcpy()?
strcpy() seems better since it doesn't rely on the correct string in name.
Definitely not. It has no boundary checks.
out_name[ACPI_NAME_LEN] = '\0';
I dunno if compiler is clever enough to catch this and avoid any warnings.
I don't see any warnings.
strncpy() fine then.
Also it seems above should also have _LEN, and not _MAX.
Do you mean for the strncpy()? I could do that but I still want to set the terminator to nul so that the string is definitely terminated.
Terminator can be not present. I should be
strncpy(out_name, name, ACPI_NAME_LEN); out_name[ACPI_NAME_LEN] = '\0';