Date: Mon, 19 Aug 2019 17:28:12 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351223 - head/sbin/ping Message-ID: <201908191728.x7JHSC7l082672@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Mon Aug 19 17:28:12 2019 New Revision: 351223 URL: https://svnweb.freebsd.org/changeset/base/351223 Log: 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 Modified: head/sbin/ping/ping.c Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Mon Aug 19 17:27:06 2019 (r351222) +++ head/sbin/ping/ping.c Mon Aug 19 17:28:12 2019 (r351223) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908191728.x7JHSC7l082672>