From 9bc73ed04336426b12418ebe250b98233ca84034 Mon Sep 17 00:00:00 2001 From: fyodor Date: Wed, 25 Apr 2007 21:20:15 +0000 Subject: [PATCH] Eddie traceroute localhost fix --- CHANGELOG | 4 ++++ traceroute.cc | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b30710538..25e596472 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,10 @@ o Fixed a bug which prevented the NSE scripts directory from appearing o Fixed a bug in Traceroute's output. It occured when a traced host could be fully consolidated, but only the first hop number was outputted. [Kris] +o Fixed a Traceroute bug relating to scanning through the localhost + interface on Windows (which previously caused a crash). Thanks to + Alan Jones for the report and Eddie Bell for the fix. + o Updated IANA assignment IP list for random IP (-iR) generation. [Kris] 4.21ALPHA4 diff --git a/traceroute.cc b/traceroute.cc index 89d996d46..17abcaa62 100644 --- a/traceroute.cc +++ b/traceroute.cc @@ -198,8 +198,12 @@ Traceroute::Traceroute (const char *device_name, devtype type) { fd = -1; ethsd = NULL; hops = NULL; + pd = NULL; total_size = 0; + if(type == devt_loopback) + return; + /* open various socks to send and read from on windows and * unix */ if ((o.sendpref & PACKET_SEND_ETH) && type == devt_ethernet) { @@ -305,8 +309,10 @@ Traceroute::~Traceroute () { delete (it->second); if (ethsd) ethsd = NULL; - close (fd); - pcap_close (pd); + if (fd != -1) + close (fd); + if(pd) + pcap_close (pd); } /* get an open or closed port from the portlist. Traceroute requires a positive response,