summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-10-30 20:57:49 +0100
committerBerke Viktor <bviktor@hexchat.org>2012-10-30 20:57:49 +0100
commit284dbfbe3dc37e94b57e110b6ea23f847b9f6035 (patch)
tree01d1268814a87e167f9ad7aaa9191ea78e31fb22 /src
parentf6c2698701a26c3cd9317dcf59ff948695eb38b7 (diff)
Supposed fix for identd ipv6 compiler warnings
Diffstat (limited to 'src')
-rw-r--r--src/common/identd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/common/identd.c b/src/common/identd.c
index e3ea9e95..f413c8ae 100644
--- a/src/common/identd.c
+++ b/src/common/identd.c
@@ -82,15 +82,15 @@ identd (char *username)
 }
 
 #ifdef USE_IPV6
+#define IPV6BUFLEN 60
 static int
 identd_ipv6 (char *username)
 {
 	int sok, read_sok, len;
 	char *p;
 	char buf[256];
-	char outbuf[256];
-	char ipv6buf[60];
-	DWORD ipv6buflen = sizeof (ipv6buf);
+	char outbuf[256];	
+	LPSTR ipv6buf = (LPSTR) malloc (IPV6BUFLEN);
 	struct sockaddr_in6 addr;
 
 	sok = socket (AF_INET6, SOCK_STREAM, 0);
@@ -98,6 +98,7 @@ identd_ipv6 (char *username)
 	if (sok == INVALID_SOCKET)
 	{
 		free (username);
+		free (ipv6buf);
 		return 0;
 	}
 
@@ -112,6 +113,7 @@ identd_ipv6 (char *username)
 	{
 		closesocket (sok);
 		free (username);
+		free (ipv6buf);
 		return 0;
 	}
 
@@ -119,6 +121,7 @@ identd_ipv6 (char *username)
 	{
 		closesocket (sok);
 		free (username);
+		free (ipv6buf);
 		return 0;
 	}
 
@@ -129,12 +132,13 @@ identd_ipv6 (char *username)
 	if (read_sok == INVALID_SOCKET)
 	{
 		free (username);
+		free (ipv6buf);
 		return 0;
 	}
 
 	identd_ipv6_is_running = FALSE;
 
-	if (WSAAddressToString ((struct sockaddr *) &addr, sizeof (addr), NULL, &ipv6buf, &ipv6buflen) == SOCKET_ERROR)
+	if (WSAAddressToString ((struct sockaddr *) &addr, sizeof (addr), NULL, ipv6buf, (LPDWORD) IPV6BUFLEN) == SOCKET_ERROR)
 	{
 		snprintf (ipv6buf, sizeof (ipv6buf) - 1, "[SOCKET ERROR: 0x%X]", WSAGetLastError ());
 	}
@@ -157,6 +161,7 @@ identd_ipv6 (char *username)
 	sleep (1);
 	closesocket (read_sok);
 	free (username);
+	free (ipv6buf);
 
 	return 0;
 }