Fix a use-after-free in lldb-server

UriParser::Parse is returning a StringRef pointing the the parsed
string, but we were calling it with a temporary string. Change this to a
local variable to make sure the string persists as long as we need it.

llvm-svn: 316740
This commit is contained in:
Pavel Labath 2017-10-27 04:53:24 +00:00
parent 52d0a49046
commit ae7dd12a30
1 changed files with 3 additions and 2 deletions

View File

@ -128,8 +128,9 @@ Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
llvm::StringRef platform_ip;
int platform_port;
llvm::StringRef platform_path;
bool ok = UriParser::Parse(GetConnection()->GetURI(), platform_scheme,
platform_ip, platform_port, platform_path);
std::string platform_uri = GetConnection()->GetURI();
bool ok = UriParser::Parse(platform_uri, platform_scheme, platform_ip,
platform_port, platform_path);
UNUSED_IF_ASSERT_DISABLED(ok);
assert(ok);