summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/FileSpec.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2015-01-20 04:20:42 +0000
committerJason Molenda <jmolenda@apple.com>2015-01-20 04:20:42 +0000
commit3bc66f1f4733fd29792c11a686d416aa9ab4cc38 (patch)
treeb9e38cd04effdf208493f2ff78f1969dafc00362 /lldb/source/Host/common/FileSpec.cpp
parent65e0642d0318528b98ee818929da95a1763c0a13 (diff)
downloadbcm5719-llvm-3bc66f1f4733fd29792c11a686d416aa9ab4cc38.tar.gz
bcm5719-llvm-3bc66f1f4733fd29792c11a686d416aa9ab4cc38.zip
Fix creation of StringRef in FileSpec::ResolveUsername()
so it doesn't assume that the SmallVector<char> will have nul terminator. It did not in at least one case. Caught by ASAN instrumentation. llvm-svn: 226544
Diffstat (limited to 'lldb/source/Host/common/FileSpec.cpp')
-rw-r--r--lldb/source/Host/common/FileSpec.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index 0af0556d30c..98b4beffe28 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -65,7 +65,7 @@ FileSpec::ResolveUsername (llvm::SmallVectorImpl<char> &path)
if (path.empty() || path[0] != '~')
return;
- llvm::StringRef path_str(path.data());
+ llvm::StringRef path_str(path.data(), path.size());
size_t slash_pos = path_str.find_first_of("/", 1);
if (slash_pos == 1 || path.size() == 1)
{
OpenPOWER on IntegriCloud