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:
parent
65e0642d03
commit
3bc66f1f47
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue