diff options
author | Aaron Smith <aaron.smith@microsoft.com> | 2019-04-17 03:13:06 +0000 |
---|---|---|
committer | Aaron Smith <aaron.smith@microsoft.com> | 2019-04-17 03:13:06 +0000 |
commit | b8ec7eee8118d8d5f64370e4619a746ceaf7d6c1 (patch) | |
tree | 139fda05cee1ee3b490c82ac42271d3ad5530c8b /lldb/source | |
parent | 990514cec829d3027bc3472427bc3457d742d2e9 (diff) | |
download | bcm5719-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.cpp | 2 |
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); } |