Index: net/base/net_util.cc |
diff --git a/net/base/net_util.cc b/net/base/net_util.cc |
index 5b3d65e515b2a060c9eabc31458b3dde0b156e32..941dca9ab53ba1a4cb3214712a4ae7e16cf7ee62 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,18 @@ 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; |
+ // addr is already set to &this->addr_storage by default ctor. |
+ 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, |