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
This commit is contained in:
Jason Molenda 2015-01-20 04:20:42 +00:00
parent 65e0642d03
commit 3bc66f1f47
1 changed files with 1 additions and 1 deletions

View File

@ -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)
{