summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-10-25 22:19:54 +0000
committerRui Ueyama <ruiu@google.com>2013-10-25 22:19:54 +0000
commita694171f345c4f420404cb3a422f0fe6996bdea1 (patch)
tree51d53ad4975f4cdc35081b0e39069dcf968f2560
parent39d90422813c533650bb0647bffaddf99cbc554a (diff)
downloadbcm5719-llvm-a694171f345c4f420404cb3a422f0fe6996bdea1.tar.gz
bcm5719-llvm-a694171f345c4f420404cb3a422f0fe6996bdea1.zip
Make sure the string is NUL-terminated.
The internal byte array of the SmallString filled by createTemporaryFile() is not guaranteed to be NUL-terminated. We need to call c_str() to handle it safely. llvm-svn: 193442
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index 8ba63974f0a..e67ad080b16 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -296,7 +296,7 @@ bool createManifestResourceFile(PECOFFLinkingContext &ctx,
// Open the temporary file for writing.
std::string errorInfo;
- llvm::raw_fd_ostream out(rcFile.data(), errorInfo);
+ llvm::raw_fd_ostream out(rcFileSmallString.c_str(), errorInfo);
if (!errorInfo.empty()) {
diagnostics << "Failed to open " << ctx.getManifestOutputPath() << ": "
<< errorInfo << "\n";
@@ -337,7 +337,7 @@ bool createManifestResourceFile(PECOFFLinkingContext &ctx,
args.push_back(programPath.c_str());
args.push_back("/fo");
args.push_back(resFile.c_str());
- args.push_back(rcFile.data());
+ args.push_back(rcFileSmallString.c_str());
args.push_back(nullptr);
if (llvm::sys::ExecuteAndWait(programPath.c_str(), &args[0]) != 0) {
OpenPOWER on IntegriCloud