This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78304
> 
> Attached the corrected version of the patch that is -Wformat warning
> free on all versions.

I pushed this version to master now.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]