acrn-hypervisor/hypervisor/debug
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
..
console.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
dbg_cmd.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
dump.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
hypercall.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
logmsg.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
Makefile hv: enhance Makefile to compile debug/release into 2 libraries 2018-11-23 08:47:34 +08:00
npk_log.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
printf.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
profiling.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
sbuf.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
shell_priv.h HV: add rdmsr/wrmsr debug cmd 2019-01-31 11:33:15 +08:00
shell.c hv: minor fixes to a few calls to strncpy_s() 2019-03-20 08:55:42 +08:00
string.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
trace.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00
uart16550.c hv: minor fixes to a few calls to strncpy_s() 2019-03-20 08:55:42 +08:00
vuart.c hv:cleanup header files for debug folder 2019-02-27 11:12:48 +08:00