public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: "CHIGOT, CLEMENT" <clement.chigot@atos.net>,
	"binutils@sourceware.org" <binutils@sourceware.org>
Cc: "pro@helflym.eu" <pro@helflym.eu>,
	Kavana N Bhat <Kavana.bhat@in.ibm.com>,
	Ayappan P2 <ayappap2@in.ibm.com>
Subject: Re: [PATCH 2/2] xcoff: implement linker relaxation
Date: Wed, 13 Apr 2022 17:32:52 +0100	[thread overview]
Message-ID: <21cd3a89-945b-25b6-fc14-1b9120ab2057@redhat.com> (raw)
In-Reply-To: <PA4PR02MB6686E4F68E95C662C60E3FBBEA129@PA4PR02MB6686.eurprd02.prod.outlook.com>

Hi Clement,

   This patch generates a compile time error (using gcc 11.2.1):

bfd/xcofflink.c: In function 'xcoff_stub_get_csect_in_range':
bfd/xcofflink.c:4332:20: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
  4332 |   sprintf (buf, "%d", n);
       |                    ^
bfd/xcofflink.c:4332:3: note: 'sprintf' output between 2 and 7 bytes into a destination of size 6
  4332 |   sprintf (buf, "%d", n);
       |   ^~~~~~~~~~~~~~~~~~~~~~

   I suggest increasing the size of "buf" to at least 8.  In addition
   if you are feeling paranoid, you could use snprintf instead of
   sprintf.

   Other than that though the patch looks good to me, so approved,
   once that above problem has been fixed.

Cheers
   Nick


  reply	other threads:[~2022-04-13 16:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17 15:01 CHIGOT, CLEMENT
2022-04-13 16:32 ` Nick Clifton [this message]
2022-04-20  9:52   ` pro
2022-04-20 14:13     ` Nick Clifton
2022-04-20 14:27       ` Luis Machado
2022-04-20 14:32       ` Alan Modra
2022-04-20 14:36         ` Luis Machado
2022-04-21 14:47         ` pro

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21cd3a89-945b-25b6-fc14-1b9120ab2057@redhat.com \
    --to=nickc@redhat.com \
    --cc=Kavana.bhat@in.ibm.com \
    --cc=ayappap2@in.ibm.com \
    --cc=binutils@sourceware.org \
    --cc=clement.chigot@atos.net \
    --cc=pro@helflym.eu \
    /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.
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).