ping: fix -Wformat-truncating warning with GCC
Increase buffer size for the string representation of n_time ICMP timestamp is a 32-bit number. In pr_ntime(), number of minutes and seconds is always 2 characters wide. Max. number of hours is 4 characters wide. The buffer size should be at least: 4 + 2 + 2 + 1 (':') + 1 (':') + 1 ('\0') = 11 Submitted by: Ján Sučan <sucanjan@gmail.com> MFC after: 2 weeks Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21325
This commit is contained in:
parent
edecb5a3c5
commit
bd1a23c8ea
@ -1661,7 +1661,7 @@ pr_retip(struct ip *ip)
|
||||
static char *
|
||||
pr_ntime(n_time timestamp)
|
||||
{
|
||||
static char buf[10];
|
||||
static char buf[11];
|
||||
int hour, min, sec;
|
||||
|
||||
sec = ntohl(timestamp) / 1000;
|
||||
|
Loading…
Reference in New Issue
Block a user