summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorburlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-14 18:34:23 +0000
committerburlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-14 18:34:23 +0000
commit3298c5517bb9aade0f397fde3626919f97e7945a (patch)
tree0d579165774883e85650a66b5ebe82b7d99e49c9
parentc5c4ed7ed13b4322fd647590e615ef0aeb5033e5 (diff)
- Fix for a bug in the win32 inet_ptoa implementation causing CIDR parsing to incorrectly return false in some instances.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7307 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--win/inspircd_win32wrapper.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp
index 6bea73640..d2dcd7456 100644
--- a/win/inspircd_win32wrapper.cpp
+++ b/win/inspircd_win32wrapper.cpp
@@ -65,6 +65,13 @@ int inet_pton(int af, const char *src, void *dst)
sockaddr_in sa;
int len = sizeof(SOCKADDR);
int rv = WSAStringToAddress((LPSTR)src, af, NULL, (LPSOCKADDR)&sa, &len);
+ if(rv >= 0)
+ {
+ if(WSAGetLastError() == 10022) // Invalid Argument
+ rv = 0;
+ else
+ rv = 1;
+ }
memcpy(dst, &sa.sin_addr, sizeof(struct in_addr));
return rv;
}