acrn-hypervisor/hypervisor/boot
Zide Chen 5c04687967 hv: minor fixes to a few calls to strncpy_s()
strncpy_s(d, dmax, s, slen): the 'dmax' includes the null terminator, while
slen doesn't. Thus if (dmax == slen == strlen(s)), strncpy_s() chooses to
discard the last character from s and instead write '\0' to d[dmax - 1].

strnlen_s(s, maxsize): if there is no terminating null character in the
first maxsize characters pointed to by s, strnlen_s() returns maxsize.

So in the following example or similar cases, we need to increase the size
of d[] by 1 to accommodate the null terminator, and add '1' to the dmax
argument to strncpy_s().

uint8_t d[MAX_LEN];
size = strnlen_s(s, MAX_LEN);
strncpy_s(d, MAX_LEN, s, size);

Tracked-On: #861
Signed-off-by: Zide Chen <zide.chen@intel.com>
2019-03-20 08:55:42 +08:00
..
include hv:cleanup header files for arch folder 2019-02-22 13:14:36 +08:00
sbl hv: minor fixes to a few calls to strncpy_s() 2019-03-20 08:55:42 +08:00
uefi HV: Modularize boot folder 2019-03-14 09:05:53 +08:00
acpi.c hv: merge SBL and UEFI related stuff under boot 2019-03-13 10:26:55 +08:00
dmar_parse.c HV: Modularize boot folder 2019-03-14 09:05:53 +08:00
reloc.c hv: cleanup some hva/hpa conversion code 2019-03-15 09:03:14 +08:00