Fix a crash in isTCPwrapped. Closes #89

This commit is contained in:
dmiller 2015-03-23 12:35:39 +00:00
parent 56c9f847f4
commit 95437a1468
2 changed files with 12 additions and 3 deletions

View file

@ -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]

View file

@ -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 {