[lld] r193442 - Make sure the string is NUL-terminated.
Rui Ueyama
ruiu at google.com
Fri Oct 25 15:19:54 PDT 2013
Author: ruiu
Date: Fri Oct 25 17:19:54 2013
New Revision: 193442
URL: http://llvm.org/viewvc/llvm-project?rev=193442&view=rev
Log:
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.
Modified:
lld/trunk/lib/Driver/WinLinkDriver.cpp
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=193442&r1=193441&r2=193442&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Fri Oct 25 17:19:54 2013
@@ -296,7 +296,7 @@ bool createManifestResourceFile(PECOFFLi
// 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(PECOFFLi
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) {
More information about the llvm-commits
mailing list