From e4d2f79fc08d6d38ebdd6f6656a7e96758461052 Mon Sep 17 00:00:00 2001 From: xwx1135370 Date: Mon, 26 Dec 2022 14:40:21 +0800 Subject: [PATCH] =?UTF-8?q?[LLDB][MAC]When=20OHOS=5FHDC=5FSERVER=5FPORT=20?= =?UTF-8?q?is=20set=20to=2088888,=20the=20LLDB=20returns=20=E2=80=9C=20inv?= =?UTF-8?q?alid=20host:port=20xxx"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xwx1135370 --- lldb/source/Plugins/Platform/OHOS/HdcClient.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/Platform/OHOS/HdcClient.cpp b/lldb/source/Plugins/Platform/OHOS/HdcClient.cpp index 6807d24cf317..1f08dc55f642 100644 --- a/lldb/source/Plugins/Platform/OHOS/HdcClient.cpp +++ b/lldb/source/Plugins/Platform/OHOS/HdcClient.cpp @@ -153,8 +153,14 @@ Status HdcClient::Connect() { std::string port = "8710"; const char *env_port = std::getenv("OHOS_HDC_SERVER_PORT"); - if ((env_port != NULL) && (atoi(env_port) > 0)) { - port = env_port; + if (env_port != NULL) { + int iEnv_port = atoi(env_port); + if ((iEnv_port > 0) && (iEnv_port <= 65535)) { + port = env_port; + } + else { + return Status("invalid port specification: %s. $OHOS_HDC_SERVER_PORT must be a positive number in (0,65535]", env_port); + } } std::string uri = "connect://localhost:" + port; -- Gitee