From 6562877ed6d8e915d7fa341a2d769f4de54e9b0c Mon Sep 17 00:00:00 2001 From: djalal Date: Thu, 9 Jun 2011 17:38:04 +0000 Subject: [PATCH] Fixed a bug: use sockaddr_storage instead of sockaddr. --- nse_nsock.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nse_nsock.cc b/nse_nsock.cc index 96e659b92..b9f388f79 100644 --- a/nse_nsock.cc +++ b/nse_nsock.cc @@ -737,13 +737,14 @@ static int l_get_info (lua_State *L) int status; int protocol; // tcp or udp int af; // address family - struct sockaddr local; - struct sockaddr remote; + struct sockaddr_storage local; + struct sockaddr_storage remote; char *ipstring_local = (char *) lua_newuserdata(L, sizeof(char) * INET6_ADDRSTRLEN); char *ipstring_remote = (char *) lua_newuserdata(L, sizeof(char) * INET6_ADDRSTRLEN); status = nsi_getlastcommunicationinfo(nu->nsiod, &protocol, &af, - &local, &remote, sizeof(sockaddr)); + (struct sockaddr*)&local, (struct sockaddr*)&remote, + sizeof(struct sockaddr_storage)); lua_pushboolean(L, true); lua_pushstring(L, inet_ntop_both(af, &local, ipstring_local));