public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Matthias Klose <doko@ubuntu.com>
Subject: Re: [PATCH] ar: Check whether ar header values fit.
Date: Wed, 20 Sep 2017 18:46:00 -0000	[thread overview]
Message-ID: <1505933162.16945.55.camel@klomp.org> (raw)
In-Reply-To: <1505474076-16062-1-git-send-email-mark@klomp.org>

On Fri, 2017-09-15 at 13:14 +0200, Mark Wielaard wrote:
> When compiling with -O3 gcc finds an interesting error:
> 
> src/ar.c: In function ‘do_oper_insert’:
> src/ar.c:1077:56: error: ‘%-*ld’ directive output may be truncated
> writing between 6 and 10 bytes into a region of size 7 [-
> Werror=format-truncation=]
>    snprintf (tmpbuf, sizeof (tmpbuf), ofmt ? "%-*lo" : "%-*ld",
> bufsize, val);
>                                                         ^~~~~
> The problem is that the ar header values have to fit in a limited
> (not zero terminated) string. We should check the snprintf return
> value to see if the values are representable.
> 
> Also make ar valgrind and ubsan clean and add a minimal sanity test.

I pushed this to master.

      reply	other threads:[~2017-09-20 18:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15 11:15 Mark Wielaard
2017-09-20 18:46 ` 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=1505933162.16945.55.camel@klomp.org \
    --to=mark@klomp.org \
    --cc=doko@ubuntu.com \
    --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).