aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/ping
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2019-08-19 17:28:12 +0000
committerAlan Somers <asomers@FreeBSD.org>2019-08-19 17:28:12 +0000
commit7898770a26e2d2405d83843f8c526de40d340265 (patch)
tree6ac433225debe6744349e59232c53efdd0d32c6b /sbin/ping
parent421c6208376fc8d62da51cea7bcc166f0d26cd87 (diff)
downloadsrc-7898770a26e2d2405d83843f8c526de40d340265.tar.gz
src-7898770a26e2d2405d83843f8c526de40d340265.zip
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
Notes
Notes: svn path=/head/; revision=351223
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 810150a7d30a..9ad51fbb7b45 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -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;