summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-05 21:05:35 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-05 21:05:35 +0000
commit016b40a118bd75cd3a3a4fc8a7c97e2508953fb8 (patch)
tree0038004aebf555b65e475bcfc6bfe3a1c1f896ea /src/socket.cpp
parenta15410696d085e1ca5eab4f71fba61a043bb2a44 (diff)
Pass sizeof(sockaddr) to bind now. Passing the size of a pointer really isnt a smart idea (and doesnt work)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6500 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index bf080172e..77239399c 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -341,8 +341,11 @@ bool InspIRCd::BindSocket(int sockfd, insp_sockaddr clientn, insp_sockaddr serve
{
/* There is an address here. */
in_addr addy;
- inet_pton(AF_INET, addr, &addy);
-
+ if (inet_pton(AF_INET, addr, &addy) < 1)
+ {
+ delete server;
+ return false;
+ }
((sockaddr_in*)server)->sin_addr = addy;
}
else
@@ -353,7 +356,7 @@ bool InspIRCd::BindSocket(int sockfd, insp_sockaddr clientn, insp_sockaddr serve
/* Bind ipv4 port number */
((sockaddr_in*)server)->sin_port = htons(port);
#endif
- int ret = bind(sockfd, server, sizeof(server));
+ int ret = bind(sockfd, server, sizeof(sockaddr));
delete server;