diff --git a/CHANGELOG b/CHANGELOG index 49694f370..6bf440899 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Nmap Changelog ($Id$); -*-text-*- +o [GH#283][Nsock] Avoid "unknown protocol:0" debug messages and an "Unknown + address family 0" crash on Windows and other platforms that do not set the + src_addr argument to recvfrom for TCP sockets. [Daniel Miller] + o [NSE][GH#371] Fix mysql-audit by adding needed library requires to the mysql-cis.audit file. The script would fail with "Failed to load rulebase" message. [Paolo Perego] diff --git a/nsock/src/nsock_core.c b/nsock/src/nsock_core.c index 0167c974e..47293144b 100644 --- a/nsock/src/nsock_core.c +++ b/nsock/src/nsock_core.c @@ -644,7 +644,11 @@ static int do_actual_read(struct npool *ms, struct nevent *nse) { err = socket_errno(); break; } - if (peerlen > 0) { + /* Windows will ignore src_addr and addrlen arguments to recvfrom on TCP + * sockets, so peerlen is still sizeof(peer) and peer is junk. Instead, + * only set this if it's not already set. + */ + if (peerlen > 0 && iod->peerlen == 0) { assert(peerlen <= sizeof(iod->peer)); memcpy(&iod->peer, &peer, peerlen); iod->peerlen = peerlen;