diff --git a/CHANGELOG b/CHANGELOG index 38e3b849a..d93ca96d3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ # Nmap Changelog ($Id$); -*-text-*- +o Fixed a crash (NULL pointer dereference) in PortList::isTCPwrapped when using + -sV and -O on an unknown service not listed in nmap-services. [Pierre Lalet] + o Fixed a benign TOCTOU race between stat() and open() in mmapfile(). Reported by Camille Mougey. [Henri Doreau] diff --git a/portlist.cc b/portlist.cc index 76635cf5d..bd534e917 100644 --- a/portlist.cc +++ b/portlist.cc @@ -897,17 +897,23 @@ bool PortList::isTCPwrapped(u16 portno) const { const Port *port = lookupPort(portno, IPPROTO_TCP); if (port == NULL) { if (o.debugging > 1) { - log_write(LOG_STDOUT, "PortList::isTCPwrapped(%d) requested but port not in list", portno); + log_write(LOG_STDOUT, "PortList::isTCPwrapped(%d) requested but port not in list\n", portno); } return false; } else if (!o.servicescan) { if (o.debugging > 1) { - log_write(LOG_STDOUT, "PortList::isTCPwrapped(%d) requested but service scan was never asked to be done", portno); + log_write(LOG_STDOUT, "PortList::isTCPwrapped(%d) requested but service scan was never asked to be done\n", portno); } return false; } else if (port->service == NULL) { if (o.debugging > 1) { - log_write(LOG_STDOUT, "PortList::isTCPwrapped(%d) requested but port has not been service scanned yet", portno); + log_write(LOG_STDOUT, "PortList::isTCPwrapped(%d) requested but port has not been service scanned yet\n", portno); + } + return false; + } else if (port->service->name == NULL) { + // no service match and port not listed in services file + if (o.debugging > 1) { + log_write(LOG_STDOUT, "PortList::isTCPwrapped(%d) requested but service has no name\n", portno); } return false; } else {