summaryrefslogtreecommitdiff
path: root/node/InetAddress.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-02-01 14:41:54 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-02-01 14:41:54 -0800
commit7a63fdc447322da3630774a894822bbe6fbb708f (patch)
tree21a02247040afdef4b3666b48304d439638e8eec /node/InetAddress.cpp
parent4655a59912ba61b2f79f74976e2448c0fb32c402 (diff)
downloadinfinitytier-7a63fdc447322da3630774a894822bbe6fbb708f.tar.gz
infinitytier-7a63fdc447322da3630774a894822bbe6fbb708f.zip
Fix for GitHub issue #298 and hopefully #297
Diffstat (limited to 'node/InetAddress.cpp')
-rw-r--r--node/InetAddress.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/node/InetAddress.cpp b/node/InetAddress.cpp
index d5cd227c..dca772e8 100644
--- a/node/InetAddress.cpp
+++ b/node/InetAddress.cpp
@@ -127,8 +127,10 @@ void InetAddress::set(const void *ipBytes,unsigned int ipLen,unsigned int port)
{
memset(this,0,sizeof(InetAddress));
if (ipLen == 4) {
+ uint32_t ipb[1];
+ memcpy(ipb,ipBytes,4);
ss_family = AF_INET;
- reinterpret_cast<struct sockaddr_in *>(this)->sin_addr.s_addr = *(reinterpret_cast<const uint32_t *>(ipBytes));
+ reinterpret_cast<struct sockaddr_in *>(this)->sin_addr.s_addr = ipb[0];
reinterpret_cast<struct sockaddr_in *>(this)->sin_port = Utils::hton((uint16_t)port);
} else if (ipLen == 16) {
ss_family = AF_INET6;