diff --git a/common.cpp b/common.cpp index c5f5ed9..217eded 100644 --- a/common.cpp +++ b/common.cpp @@ -399,12 +399,12 @@ int inet_pton(int af, const char *src, void *dst) { struct sockaddr_storage ss; int size = sizeof(ss); - char src_copy[INET6_ADDRSTRLEN+1]; + char src_copy[max_addr_len+1]; ZeroMemory(&ss, sizeof(ss)); /* stupid non-const API */ - strncpy (src_copy, src, INET6_ADDRSTRLEN+1); - src_copy[INET6_ADDRSTRLEN] = 0; + strncpy (src_copy, src, max_addr_len+1); + src_copy[max_addr_len] = 0; if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) { switch(af) { diff --git a/common.h b/common.h index 9c78a41..c81c558 100644 --- a/common.h +++ b/common.h @@ -39,7 +39,6 @@ #endif #include -#include #if defined(__MINGW32__) #include @@ -54,6 +53,7 @@ typedef int socklen_t; #include #include #include +#include #endif