bridge: avoid snprint truncation on time
This fixes new gcc warning about possible string overflow.
mdb.c: In function ‘__print_router_port_stats’:
mdb.c:61:11: warning: ‘%.2i’ directive output may be truncated
writing between 2 and 7 bytes into a region of size
between 0 and 4 [-Wformat-truncation=]
"%4i.%.2i", (int)tv.tv_sec,
^~~~
Note: already fixed in iproute2-next.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
83b3c60544
commit
6c6c0291d2
|
|
@ -55,7 +55,7 @@ static void __print_router_port_stats(FILE *f, struct rtattr *pattr)
|
|||
__jiffies_to_tv(&tv,
|
||||
rta_getattr_u32(tb[MDBA_ROUTER_PATTR_TIMER]));
|
||||
if (jw_global) {
|
||||
char formatted_time[9];
|
||||
char formatted_time[32];
|
||||
|
||||
snprintf(formatted_time, sizeof(formatted_time),
|
||||
"%4i.%.2i", (int)tv.tv_sec,
|
||||
|
|
@ -184,7 +184,7 @@ static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e,
|
|||
|
||||
__jiffies_to_tv(&tv, rta_getattr_u32(tb[MDBA_MDB_EATTR_TIMER]));
|
||||
if (jw_global) {
|
||||
char formatted_time[9];
|
||||
char formatted_time[32];
|
||||
|
||||
snprintf(formatted_time, sizeof(formatted_time),
|
||||
"%4i.%.2i", (int)tv.tv_sec,
|
||||
|
|
|
|||
Loading…
Reference in New Issue