mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-15 21:01:04 +00:00
hv: fix the bug in common library sprintf.c
The compiler report the error:
lib/sprintf.c:102:42: error: initializer-string for array of 'char'
truncates NUL terminator but destination lacks 'nonstring' attribute (6
chars into 5 available) [-Werror=unterminated-string-initialization]
102 | static const char flagchars[5] = "#0- +";
| ^~~~~~~
The fix is to change flagchars[5] to flagchars[6].
Tracked-On: #8803
Signed-off-by: Haoyu Tang <haoyu.tang@intel.com>
Reviewed-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
@@ -99,7 +99,7 @@ static const char *get_flags(const char *s_arg, uint32_t *flags)
|
||||
{
|
||||
const char *s = s_arg;
|
||||
/* contains the flag characters */
|
||||
static const char flagchars[5] = "#0- +";
|
||||
static const char flagchars[6] = "#0- +";
|
||||
/* contains the numeric flags for the characters above */
|
||||
static const uint32_t fl[sizeof(flagchars)] = {
|
||||
PRINT_FLAG_ALTERNATE_FORM, /* # */
|
||||
|
||||
Reference in New Issue
Block a user