Nmap Development mailing list archives

nsock wrong peer info


From: "??????" <saiyn.chen () qq com>
Date: Tue, 19 Mar 2019 10:50:52 +0800

Hi there,


    when you use nsock_sendto() to query a multicast service like upnp or mdns, after you call 
nsock_liod_get_communication_info() in the receive callback to get the peer info, the peer info always
fails to update to the real peer info but still the info set in nsock_sendto().


     The root cause is very simple and I post below:


/* 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;
      }



so, can we fix this or just let it there?




BR,
SAIYN
_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: