This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH] ar: Fix GCC7 -Wformat-length issues.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 18 Nov 2016 14:10:16 +0100
- Subject: Re: [PATCH] ar: Fix GCC7 -Wformat-length issues.
On Fri, 2016-11-11 at 13:10 +0100, Mark Wielaard wrote:
> On Thu, 2016-11-10 at 18:52 +0100, Mark Wielaard wrote:
> > GCC7 adds warnings for snprintf formatting into too small buffers.
> > Fix the two issues pointed out by the new warning. The ar header
> > fields are fixed length containing left-justified strings without
> > zero terminator. snprintf always adds a '\0' char at the end (which
> > we then don't copy into the ar header field) and numbers are decimal
> > strings of fixed 10 chars (-Wformat-length thinks formatting
> > them as size_t might overflow on 64bit arches).
> That fix was slightly wrong. The numbers should be formatted as unsigned
> decimals. And I wasn't passing in the right type. GCC7 missed my
> mistakes, but older GCC versions caught it. I filed a bug:
> Attached the corrected version of the patch that is -Wformat warning
> free on all versions.
I pushed this version to master now.