Commit 3d399218 authored by sonu1.yadav's avatar sonu1.yadav Committed by Erich Keane

Fix IOT-605: fridgeclient executable's abnormal termination

Change-Id: Idcfcd4296d76742859e10b44f36f3ca56ce76ca0
Signed-off-by: default avatarsonu1.yadav <sonu1.yadav@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1644Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarErich Keane <erich.keane@intel.com>
parent f5fe2f51
......@@ -130,11 +130,12 @@ void OCResource::setHost(const std::string& host)
throw ResourceInitException(m_uri.empty(), m_resourceTypes.empty(),
m_interfaces.empty(), m_clientWrapper.expired(), false, false);
}
std::string ip6Addr = host_token.substr(0, found);
// extract the ipaddress
std::string ip6Addr = host_token.substr(1, found-1);
ip6Addr.copy(m_devAddr.addr, sizeof(m_devAddr.addr));
m_devAddr.addr[ip6Addr.length()] = '\0';
host_token = host_token.substr(found + 1);
//skip ']' and ':' characters in host string
host_token = host_token.substr(found + 2);
}
else
{
......@@ -149,11 +150,11 @@ void OCResource::setHost(const std::string& host)
std::string addrPart = host_token.substr(0, found);
addrPart.copy(m_devAddr.addr, sizeof(m_devAddr.addr));
m_devAddr.addr[addrPart.length()] = '\0';
//skip ':' character in host string
host_token = host_token.substr(found + 1);
}
int port = stoi(host_token);
int port = std::stoi(host_token);
if( port < 0 || port > UINT16_MAX )
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment