mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49:29 +00:00
Fixed a bug: use sockaddr_storage instead of sockaddr.
This commit is contained in:
parent
fcf372864a
commit
6562877ed6
1 changed files with 4 additions and 3 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue