From: Eli Zaretskii <eliz@gnu.org>
To: Ken Brown <kbrown@cornell.edu>
Cc: 32230@debbugs.gnu.org, eggert@cs.ucla.edu
Subject: bug#32230: 27.0.50; GCC 7 warning due to -Wformat-overflow
Date: Sat, 21 Jul 2018 09:53:04 +0300 [thread overview]
Message-ID: <83fu0dyt9r.fsf@gnu.org> (raw)
In-Reply-To: <2d9037f1-e52f-f3ca-7c53-e203ea6ae520@cornell.edu> (message from Ken Brown on Fri, 20 Jul 2018 18:02:07 -0400)
> From: Ken Brown <kbrown@cornell.edu>
> Date: Fri, 20 Jul 2018 18:02:07 -0400
> Cc: Paul Eggert <eggert@cs.ucla.edu>
>
> The Cygwin-w32 build has turned up another GCC 7 warning:
>
> ../../master/src/w32term.c: In function ‘x_draw_glyph_string’:
> ../../master/src/w32term.c:1477:27: warning: ‘__builtin___sprintf_chk’
> may write a terminating nul past the end of the destination
> [-Wformat-overflow=]
> sprintf ((char *) buf, "%0*X",
> ^
> ../../master/src/w32term.c:1477:4: note: ‘__builtin___sprintf_chk’
> output between 5 and 8 bytes into a destination of size 7
> sprintf ((char *) buf, "%0*X",
> ^
> The method that Paul used in bug#32189 could be used here too, but I'm
> not sure it's worth the trouble. My inclination is to just increase the
> buffer size from 7 to 8.
Yes, with a comment explaining why 8.
But do you understand why it says "between 5 and 8 bytes"? The
corresponding argument to snprintf is either 4 or 6, so it should be
between 5 and 7. Where could the extra byte come from? Is that
because glyphless.ch is a 25-bit field?
next prev parent reply other threads:[~2018-07-21 6:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 22:02 bug#32230: 27.0.50; GCC 7 warning due to -Wformat-overflow Ken Brown
2018-07-21 6:53 ` Eli Zaretskii [this message]
2018-07-21 7:26 ` Eli Zaretskii
2018-07-21 12:42 ` Ken Brown
2018-07-21 12:47 ` Eli Zaretskii
2018-07-21 16:26 ` Ken Brown
2018-07-21 16:40 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83fu0dyt9r.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=32230@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=kbrown@cornell.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).