[llvm] d9b3a94 - [NFC] Change strcpy to std::copy

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 01:44:31 PDT 2023


Author: Ilyas Mustafazade
Date: 2023-03-21T09:44:23+01:00
New Revision: d9b3a9442530c5db302c0af62196e6d907453a23

URL: https://github.com/llvm/llvm-project/commit/d9b3a9442530c5db302c0af62196e6d907453a23
DIFF: https://github.com/llvm/llvm-project/commit/d9b3a9442530c5db302c0af62196e6d907453a23.diff

LOG: [NFC] Change strcpy to std::copy

Differential Revision: https://reviews.llvm.org/D146382

Added: 
    

Modified: 
    llvm/lib/Object/COFFImportFile.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp
index 7090d3ca5618f..ce6d84d5c2347 100644
--- a/llvm/lib/Object/COFFImportFile.cpp
+++ b/llvm/lib/Object/COFFImportFile.cpp
@@ -86,7 +86,8 @@ static void writeStringTable(std::vector<uint8_t> &B,
 
   for (const auto &S : Strings) {
     B.resize(Pos + S.length() + 1);
-    strcpy(reinterpret_cast<char *>(&B[Pos]), S.c_str());
+    std::copy(S.begin(), S.end(), std::next(B.begin(), Pos));
+    B[Pos + S.length()] = 0;
     Pos += S.length() + 1;
   }
 


        


More information about the llvm-commits mailing list