[PATCH] D122391: [llvm] Fix string copy confusion
Nathan Sidwell via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 28 09:38:36 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd1587c38e6ba: [llvm] Fix string copy confusion (authored by urnathan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122391/new/
https://reviews.llvm.org/D122391
Files:
llvm/lib/Demangle/MicrosoftDemangle.cpp
Index: llvm/lib/Demangle/MicrosoftDemangle.cpp
===================================================================
--- llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -245,8 +245,8 @@
}
StringView Demangler::copyString(StringView Borrowed) {
- char *Stable = Arena.allocUnalignedBuffer(Borrowed.size() + 1);
- std::strcpy(Stable, Borrowed.begin());
+ char *Stable = Arena.allocUnalignedBuffer(Borrowed.size());
+ std::memcpy(Stable, Borrowed.begin(), Borrowed.size());
return {Stable, Borrowed.size()};
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122391.418622.patch
Type: text/x-patch
Size: 558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220328/69ed1955/attachment.bin>
More information about the llvm-commits
mailing list