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

Fixing another possible NULL dereference, in getTracePort() in traceroute.cc. Found with Coverity, CID 29

This commit is contained in:
kris
2007-11-16 03:45:03 +00:00
parent ad7b6e416b
commit 477214a779

View File

@@ -326,6 +326,7 @@ Traceroute::getTracePort (u8 proto, Target * t) {
u16 filtered_port = 1;
u16 state = 0;
u16 port = 0;
struct Port *np;
/* Use the first specified port for ping traceroutes */
if (o.pingscan) {
@@ -360,7 +361,11 @@ Traceroute::getTracePort (u8 proto, Target * t) {
return -1;
}
port = t->ports.nextPort (NULL, proto, state)->portno;
np = t->ports.nextPort (NULL, proto, state);
if (!np)
return -1;
port = np->portno;
/* If this is a protocol scan traceroute and we are using
* one of the major protocols, set up the required information