[PATCH] D146382: Change strcpy to strncpy

Ilyas Mustafazade via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 19 07:52:08 PDT 2023


1lyasm created this revision.
1lyasm added reviewers: Bigcheese, nikic.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
1lyasm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146382

Files:
  llvm/lib/Object/COFFImportFile.cpp


Index: llvm/lib/Object/COFFImportFile.cpp
===================================================================
--- llvm/lib/Object/COFFImportFile.cpp
+++ llvm/lib/Object/COFFImportFile.cpp
@@ -86,7 +86,7 @@
 
   for (const auto &S : Strings) {
     B.resize(Pos + S.length() + 1);
-    strcpy(reinterpret_cast<char *>(&B[Pos]), S.c_str());
+    strncpy(reinterpret_cast<char *>(&B[Pos]), S.c_str(), S.size());
     Pos += S.length() + 1;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146382.506395.patch
Type: text/x-patch
Size: 444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230319/36d8b2c3/attachment.bin>


More information about the llvm-commits mailing list