summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-10-27 04:53:24 +0000
committerPavel Labath <labath@google.com>2017-10-27 04:53:24 +0000
commitae7dd12a301dc7acf2bf713e81154954b3f16372 (patch)
tree37ef3e832a2d8764c376f682cd51b014f441be50 /lldb/source/Plugins/Process/gdb-remote
parent52d0a49046f0393b315b5743c5f341ebc6b1da06 (diff)
downloadbcm5719-llvm-ae7dd12a301dc7acf2bf713e81154954b3f16372.tar.gz
bcm5719-llvm-ae7dd12a301dc7acf2bf713e81154954b3f16372.zip
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
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 977c34c2a69..04ed9d704e1 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -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);
OpenPOWER on IntegriCloud