mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Avoid some theoretical null pointer derefs
This commit is contained in:
@@ -1366,7 +1366,9 @@ int FPHost::choose_osscan_ports() {
|
|||||||
if ((tport = this->target_host->ports.nextPort(tport, &port, IPPROTO_TCP, PORT_OPEN)))
|
if ((tport = this->target_host->ports.nextPort(tport, &port, IPPROTO_TCP, PORT_OPEN)))
|
||||||
this->open_port_tcp = tport->portno;
|
this->open_port_tcp = tport->portno;
|
||||||
}
|
}
|
||||||
|
if (this->target_host->FPR != NULL) {
|
||||||
this->target_host->FPR->osscan_opentcpport = this->open_port_tcp;
|
this->target_host->FPR->osscan_opentcpport = this->open_port_tcp;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* If we don't have an open port, set it to -1 so we don't send probes that
|
/* If we don't have an open port, set it to -1 so we don't send probes that
|
||||||
* target TCP open ports */
|
* target TCP open ports */
|
||||||
@@ -1382,7 +1384,9 @@ int FPHost::choose_osscan_ports() {
|
|||||||
if (tport->portno == 0)
|
if (tport->portno == 0)
|
||||||
if ((tport = this->target_host->ports.nextPort(tport, &port, IPPROTO_TCP, PORT_CLOSED)))
|
if ((tport = this->target_host->ports.nextPort(tport, &port, IPPROTO_TCP, PORT_CLOSED)))
|
||||||
this->closed_port_tcp = tport->portno;
|
this->closed_port_tcp = tport->portno;
|
||||||
|
if (this->target_host->FPR != NULL) {
|
||||||
this->target_host->FPR->osscan_closedtcpport = this->closed_port_tcp;
|
this->target_host->FPR->osscan_closedtcpport = this->closed_port_tcp;
|
||||||
|
}
|
||||||
} else if ((tport = this->target_host->ports.nextPort(NULL, &port, IPPROTO_TCP, PORT_UNFILTERED))) {
|
} else if ((tport = this->target_host->ports.nextPort(NULL, &port, IPPROTO_TCP, PORT_UNFILTERED))) {
|
||||||
/* Well, we will settle for unfiltered */
|
/* Well, we will settle for unfiltered */
|
||||||
this->closed_port_tcp = tport->portno;
|
this->closed_port_tcp = tport->portno;
|
||||||
@@ -1405,7 +1409,9 @@ int FPHost::choose_osscan_ports() {
|
|||||||
if (tport->portno == 0)
|
if (tport->portno == 0)
|
||||||
if ((tport = this->target_host->ports.nextPort(tport, &port, IPPROTO_UDP, PORT_CLOSED)))
|
if ((tport = this->target_host->ports.nextPort(tport, &port, IPPROTO_UDP, PORT_CLOSED)))
|
||||||
this->closed_port_udp = tport->portno;
|
this->closed_port_udp = tport->portno;
|
||||||
|
if (this->target_host->FPR != NULL) {
|
||||||
this->target_host->FPR->osscan_closedudpport = this->closed_port_udp;
|
this->target_host->FPR->osscan_closedudpport = this->closed_port_udp;
|
||||||
|
}
|
||||||
} else if ((tport = this->target_host->ports.nextPort(NULL, &port, IPPROTO_UDP, PORT_UNFILTERED))) {
|
} else if ((tport = this->target_host->ports.nextPort(NULL, &port, IPPROTO_UDP, PORT_UNFILTERED))) {
|
||||||
/* Well, we will settle for unfiltered */
|
/* Well, we will settle for unfiltered */
|
||||||
this->closed_port_udp = tport->portno;
|
this->closed_port_udp = tport->portno;
|
||||||
|
|||||||
@@ -499,6 +499,7 @@ static void do_possible_writes() {
|
|||||||
servI->to_process.pop_front();
|
servI->to_process.pop_front();
|
||||||
} else if (!new_reqs.empty()) {
|
} else if (!new_reqs.empty()) {
|
||||||
tpreq = new_reqs.front();
|
tpreq = new_reqs.front();
|
||||||
|
assert(tpreq != NULL);
|
||||||
tpreq->first_server = tpreq->curr_server = &*servI;
|
tpreq->first_server = tpreq->curr_server = &*servI;
|
||||||
new_reqs.pop_front();
|
new_reqs.pop_front();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,6 +322,7 @@ void handle_connect_result(struct npool *ms, struct nevent *nse, enum nse_status
|
|||||||
int optval;
|
int optval;
|
||||||
socklen_t optlen = sizeof(int);
|
socklen_t optlen = sizeof(int);
|
||||||
struct niod *iod = nse->iod;
|
struct niod *iod = nse->iod;
|
||||||
|
assert(iod != NULL);
|
||||||
#if HAVE_OPENSSL
|
#if HAVE_OPENSSL
|
||||||
int sslerr;
|
int sslerr;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ void nsock_proxychain_delete(nsock_proxychain chain) {
|
|||||||
|
|
||||||
int nsock_pool_set_proxychain(nsock_pool nspool, nsock_proxychain chain) {
|
int nsock_pool_set_proxychain(nsock_pool nspool, nsock_proxychain chain) {
|
||||||
struct npool *nsp = (struct npool *)nspool;
|
struct npool *nsp = (struct npool *)nspool;
|
||||||
|
assert(nsp != NULL);
|
||||||
|
|
||||||
if (nsp && nsp->px_chain) {
|
if (nsp && nsp->px_chain) {
|
||||||
nsock_log_error("Invalid call. Existing proxychain on this nsock_pool");
|
nsock_log_error("Invalid call. Existing proxychain on this nsock_pool");
|
||||||
|
|||||||
Reference in New Issue
Block a user