mirror of
https://github.com/nmap/nmap.git
synced 2026-01-07 15:09:01 +00:00
Avoid clobbering nsiod.peer with junk data if recvfrom doesn't set src_addr
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user