nping-ProbeMode.cc.patch revision 5796
5796N/A# SPARC misalignment bug: 21492790
5796N/A# Internal patch.
5796N/A# Most likely not for upstream.
5796N/A--- nmap-7.01/nping/ProbeMode.cc 2015-06-27 01:21:53.000000000 -0700
5796N/A+++ nmap-7.01/nping/ProbeMode.cc 2016-03-17 09:21:12.931989483 -0700
5796N/A@@ -1621,7 +1621,8 @@
5796N/A char final_output[65535];
5796N/A nsock_event_id ev_id;
5796N/A struct timeval *t = (struct timeval *)nsock_gettimeofday();
5796N/A- const unsigned char *packet=NULL;
5796N/A+ unsigned char *packet=NULL;
5796N/A+ const unsigned char *pkt = NULL;
5796N/A const unsigned char *link=NULL;
5796N/A size_t linklen=0;
5796N/A size_t packetlen=0;
5796N/A@@ -1633,8 +1634,11 @@
5796N/A NpingTarget *trg=NULL;
5796N/A u16 *prt=NULL;
5796N/A u8 proto=0;
5796N/A+ int r = 0;
5796N/A+ unsigned char *p;
5796N/A bool ip=false;
5796N/A- memset(final_output, 0, sizeof(final_output));
5796N/A+
5796N/A+ (void) std::memset(final_output, 0, sizeof(final_output));
5796N/A
5796N/A nping_print(DBG_4, "nping_event_handler(): Received callback of type %s with status %s",
5796N/A nse_type2str(type), nse_status2str(status));
5796N/A@@ -1687,7 +1691,18 @@
5796N/A case NSE_TYPE_PCAP_READ:
5796N/A
5796N/A /* Read a packet */
5796N/A- nse_readpcap(nse, &link, &linklen, &packet, &packetlen, NULL, &pcaptime);
5796N/A+ nse_readpcap(nse, &link, &linklen, &pkt, &packetlen, NULL,
5796N/A+ &pcaptime);
5796N/A+ r = posix_memalign((void**) &p, 8U, (size_t) packetlen);
5796N/A+ if (r != 0) {
5796N/A+ nping_warning(QT_2,
5796N/A+ "posix_memalign failed (%i). trying malloc", r);
5796N/A+ p = (unsigned char*) safe_malloc(packetlen);
5796N/A+ }
5796N/A+
5796N/A+ packet = p;
5796N/A+ (void) std::memcpy(const_cast<void*>(reinterpret_cast<const void*>(packet)),
5796N/A+ const_cast<void*>(reinterpret_cast<const void*>(pkt)), packetlen);
5796N/A
5796N/A /* If we are on a Ethernet network, extract the next packet protocol
5796N/A * from the Ethernet frame. */
5796N/A@@ -1821,6 +1836,8 @@
5796N/A } else{
5796N/A nping_warning(QT_2, "nping_event_handler(): Unknown status code %d\n", status);
5796N/A }
5796N/A+
5796N/A+ std::free(packet);
5796N/A return;
5796N/A
5796N/A } /* End of nping_event_handler() */