Index: net/base/net_util.cc |
diff --git a/net/base/net_util.cc b/net/base/net_util.cc |
index 5b3d65e515b2a060c9eabc31458b3dde0b156e32..2142e2a838d7ec86716143aef8f39e144af6ae17 100644 |
--- a/net/base/net_util.cc |
+++ b/net/base/net_util.cc |
@@ -5,6 +5,7 @@ |
#include "net/base/net_util.h" |
#include <errno.h> |
+#include <string.h> |
#include <algorithm> |
#include <iterator> |
@@ -501,6 +502,17 @@ bool IsIPAddressReserved(const IPAddressNumber& host_addr) { |
return false; |
} |
+SockaddrStorage::SockaddrStorage(const SockaddrStorage& other) |
+ : addr_len(other.addr_len), |
+ addr(reinterpret_cast<struct sockaddr*>(&addr_storage)) { |
+ memcpy(addr, other.addr, addr_len); |
+} |
+ |
+void SockaddrStorage::operator=(const SockaddrStorage& other) { |
+ addr_len = other.addr_len; |
mmenke
2014/06/26 20:04:00
You need to initialize addr here.
byungchul
2014/06/27 00:08:36
addr is already initialied to &addr_storage by def
|
+ memcpy(addr, other.addr, addr_len); |
+} |
+ |
// Extracts the address and port portions of a sockaddr. |
bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr, |
socklen_t sock_addr_len, |