zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 0/1] Fix -Wformat-overflow= warnings in zftp.c
@ 2019-03-23 10:11 Wesley Schwengle
  2019-03-23 10:11 ` [PATCH] Change handrolled strftime to strftime " Wesley Schwengle
  0 siblings, 1 reply; 9+ messages in thread
From: Wesley Schwengle @ 2019-03-23 10:11 UTC (permalink / raw)
  To: zsh-workers; +Cc: Wesley Schwengle

Hello all,

I was compiling zsh from master on my Debian testing box with cc 8.3.0
and I got the following warning:

zftp.c: In function ‘zfstats’:
zftp.c:1265:26: warning: ‘%02d’ directive writing between 2 and 11 bytes
into a region of size between 9 and 16 [-Wformat-overflow=]
sprintf(tmbuf, "%04d%02d%02d%02d%02d%02d",
^~~~
zftp.c:1265:21: note: directive argument in the range [-2147483647, 2147483647]
sprintf(tmbuf, "%04d%02d%02d%02d%02d%02d",
^~~~~~~~~~~~~~~~~~~~~~~~~~
zftp.c:1265:6: note: ‘sprintf’ output between 15 and 67 bytes into a
destination of size 20
sprintf(tmbuf, "%04d%02d%02d%02d%02d%02d",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tm->tm_year + 1900, tm->tm_mon+1, tm->tm_mday,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tm->tm_hour, tm->tm_min, tm->tm_sec);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I made a small patch that resolves the warning.

Cheers,
Wesley

Wesley Schwengle (1):
  Change handrolled strftime to strftime in zftp.c

 Src/Modules/zftp.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

-- 
2.21.0.196.g041f5ea1cf


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-03-25 15:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-23 10:11 [PATCH 0/1] Fix -Wformat-overflow= warnings in zftp.c Wesley Schwengle
2019-03-23 10:11 ` [PATCH] Change handrolled strftime to strftime " Wesley Schwengle
2019-03-25 12:13   ` Jun T
2019-03-25 12:42     ` Peter Stephenson
2019-03-25 13:07       ` Jun T.
2019-03-25 13:32         ` Jun T.
2019-03-25 14:36         ` Peter Stephenson
2019-03-25 15:06           ` Jun T.
2019-03-25 15:08           ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).