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:
Haoyu Tang
2025-09-19 15:06:27 +08:00
committed by acrnsi-robot
parent bb9817b866
commit 5c1726a78f

View File

@@ -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, /* # */