From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Subject: Re: [PATCH] readelf: Workaround stringop-truncation error
Date: Thu, 9 Dec 2021 00:14:13 +0100 [thread overview]
Message-ID: <YbE8RY1hkoaK1kZ8@wildebeest.org> (raw)
In-Reply-To: <20211204211504.276502-1-mark@klomp.org>
On Sat, Dec 04, 2021 at 10:15:04PM +0100, Mark Wielaard wrote:
> In function ‘strncpy’,
> inlined from ‘print_ehdr’ at readelf.c:1175:4:
> error: ‘__builtin_strncpy’ specified bound 512 equals destination size
> [-Werror=stringop-truncation]
>
> strncpy doesn't terminate the copied string if there is not enough
> room. We compensate later by explicitly adding a zero terminator at
> buf[sizeof (buf) - 1]. Normally gcc does see this, but with
> -fsanitize=address there is too much (checking) code in between. But
> it is actually better to not let strncpy do too much work, so
> substract one from the size.
Pushed,
Mark
prev parent reply other threads:[~2021-12-08 23:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-04 21:15 Mark Wielaard
2021-12-08 23:14 ` Mark Wielaard [this message]
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=YbE8RY1hkoaK1kZ8@wildebeest.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
/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).