Index: COFF/Writer.cpp =================================================================== --- COFF/Writer.cpp +++ COFF/Writer.cpp @@ -205,7 +205,8 @@ *Hdr = Header; if (StringTableOff) { // If name is too long, write offset into the string table as a name. - sprintf(Hdr->Name, "/%d", StringTableOff); + snprintf(Hdr->Name, static_cast(COFF::NameSize), "/%lu", + static_cast(StringTableOff)); } else { assert(!Config->Debug || Name.size() <= COFF::NameSize); strncpy(Hdr->Name, Name.data(),