1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Avoid some theoretical null pointer derefs

This commit is contained in:
dmiller
2016-07-30 03:54:00 +00:00
parent 7f6595112d
commit 74cade6f39
4 changed files with 12 additions and 3 deletions

View File

@@ -1366,7 +1366,9 @@ int FPHost::choose_osscan_ports() {
if ((tport = this->target_host->ports.nextPort(tport, &port, IPPROTO_TCP, PORT_OPEN)))
this->open_port_tcp = tport->portno;
}
this->target_host->FPR->osscan_opentcpport = this->open_port_tcp;
if (this->target_host->FPR != NULL) {
this->target_host->FPR->osscan_opentcpport = this->open_port_tcp;
}
} else {
/* If we don't have an open port, set it to -1 so we don't send probes that
* target TCP open ports */
@@ -1382,7 +1384,9 @@ int FPHost::choose_osscan_ports() {
if (tport->portno == 0)
if ((tport = this->target_host->ports.nextPort(tport, &port, IPPROTO_TCP, PORT_CLOSED)))
this->closed_port_tcp = tport->portno;
this->target_host->FPR->osscan_closedtcpport = this->closed_port_tcp;
if (this->target_host->FPR != NULL) {
this->target_host->FPR->osscan_closedtcpport = this->closed_port_tcp;
}
} else if ((tport = this->target_host->ports.nextPort(NULL, &port, IPPROTO_TCP, PORT_UNFILTERED))) {
/* Well, we will settle for unfiltered */
this->closed_port_tcp = tport->portno;
@@ -1405,7 +1409,9 @@ int FPHost::choose_osscan_ports() {
if (tport->portno == 0)
if ((tport = this->target_host->ports.nextPort(tport, &port, IPPROTO_UDP, PORT_CLOSED)))
this->closed_port_udp = tport->portno;
this->target_host->FPR->osscan_closedudpport = this->closed_port_udp;
if (this->target_host->FPR != NULL) {
this->target_host->FPR->osscan_closedudpport = this->closed_port_udp;
}
} else if ((tport = this->target_host->ports.nextPort(NULL, &port, IPPROTO_UDP, PORT_UNFILTERED))) {
/* Well, we will settle for unfiltered */
this->closed_port_udp = tport->portno;