diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-20 18:35:22 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-20 18:35:22 +0000 |
commit | 4b75046c49147b5a7235bcff0017a7e66b3ed900 (patch) | |
tree | 6ed4d088049c4318f8ddfb922eba9bb731015b46 | |
parent | 03a3ca90198b1e61c72c817c58b68d55b8115d22 (diff) |
Add comments explaining why we have sockaddr[2] so that nobody goes 'w...t..f...'
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7779 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/inspsocket.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index eb92030c2..2cfa6fd67 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -179,6 +179,7 @@ bool InspSocket::BindAddr(const std::string &ip) { if (!ip.empty() || ((IP != "*") && (IP != "127.0.0.1") && (!IP.empty()) && (IP != "::1"))) { + /* The [2] is required because we may write a sockaddr_in6 here, and sockaddr_in6 is larger than sockaddr, where sockaddr_in4 is not. */ sockaddr* s = new sockaddr[2]; #ifdef IPV6 if (v6) @@ -236,6 +237,7 @@ bool InspSocket::BindAddr(const std::string &ip) bool InspSocket::DoConnect() { + /* The [2] is required because we may write a sockaddr_in6 here, and sockaddr_in6 is larger than sockaddr, where sockaddr_in4 is not. */ sockaddr* addr = new sockaddr[2]; socklen_t size = sizeof(sockaddr_in); #ifdef IPV6 @@ -594,6 +596,7 @@ bool InspSocket::Poll() break; case I_LISTENING: { + /* The [2] is required because we may write a sockaddr_in6 here, and sockaddr_in6 is larger than sockaddr, where sockaddr_in4 is not. */ sockaddr* client = new sockaddr[2]; length = sizeof (sockaddr_in); std::string recvip; |