summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
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;