From 016b40a118bd75cd3a3a4fc8a7c97e2508953fb8 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 5 Feb 2007 21:05:35 +0000 Subject: 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 --- src/socket.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/socket.cpp') 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; -- cgit v1.2.3