summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorAaron Smith <aaron.smith@microsoft.com>2019-04-17 03:13:06 +0000
committerAaron Smith <aaron.smith@microsoft.com>2019-04-17 03:13:06 +0000
commitb8ec7eee8118d8d5f64370e4619a746ceaf7d6c1 (patch)
tree139fda05cee1ee3b490c82ac42271d3ad5530c8b /lldb/source
parent990514cec829d3027bc3472427bc3457d742d2e9 (diff)
downloadbcm5719-llvm-b8ec7eee8118d8d5f64370e4619a746ceaf7d6c1.tar.gz
bcm5719-llvm-b8ec7eee8118d8d5f64370e4619a746ceaf7d6c1.zip
Clear the output string passed to GetHostName()
LLVM's wchar to UTF8 conversion routine expects an empty string to store the output. GetHostName() on Windows is sometimes called with a non-empty string which triggers an assert. The simple fix is to clear the output string before the conversion. llvm-svn: 358550
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Host/windows/HostInfoWindows.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lldb/source/Host/windows/HostInfoWindows.cpp b/lldb/source/Host/windows/HostInfoWindows.cpp
index 8cd8f2d2fc5..459703ff0ed 100644
--- a/lldb/source/Host/windows/HostInfoWindows.cpp
+++ b/lldb/source/Host/windows/HostInfoWindows.cpp
@@ -95,6 +95,8 @@ bool HostInfoWindows::GetHostname(std::string &s) {
if (!::GetComputerNameW(buffer, &dwSize))
return false;
+ // The conversion requires an empty string.
+ s.clear();
return llvm::convertWideToUTF8(buffer, s);
}
OpenPOWER on IntegriCloud