From: Rui Ueyama Date: Wed, 15 Feb 2017 01:48:33 +0000 (+0000) Subject: Revert r295138: Instead of a series of string operations, use snprintf(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da87ca0f4ce7ce066b84dc68389d4b87869e2a4e;p=llvm Revert r295138: Instead of a series of string operations, use snprintf(). This broke buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295142 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 091693a483a..8ed5dd0c45e 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -434,8 +434,10 @@ void WinCOFFObjectWriter::SetSectionName(COFFSection &S) { uint64_t StringTableEntry = Strings.getOffset(S.Name); if (StringTableEntry <= Max7DecimalOffset) { - snprintf(S.Header.Name, sizeof(S.Header.Name), "/%" PRIu64, - StringTableEntry); + SmallVector Buffer; + Twine('/').concat(Twine(StringTableEntry)).toVector(Buffer); + assert(Buffer.size() <= COFF::NameSize && Buffer.size() >= 2); + std::memcpy(S.Header.Name, Buffer.data(), Buffer.size()); return; } if (StringTableEntry <= MaxBase64Offset) {