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. Cheers, Mark