mirror of
https://github.com/nmap/nmap.git
synced 2025-12-15 04:09:01 +00:00
Fix the display of "Unknown protocol" in ippackethdrinfo.
nexthdrtoa always returns the same static buffer, so it is never NULL. Check for an empty string instead.
This commit is contained in:
@@ -2931,12 +2931,15 @@ icmpbad:
|
||||
hdr.proto, srchost, dsthost,
|
||||
icmpv6->icmpv6_type, icmpv6->icmpv6_code, ipinfo);
|
||||
} else {
|
||||
if (nexthdrtoa(hdr.proto, 1) == NULL) {
|
||||
const char *hdrstr;
|
||||
|
||||
hdrstr = nexthdrtoa(hdr.proto, 1);
|
||||
if (hdrstr == NULL || *hdrstr == '\0') {
|
||||
Snprintf(protoinfo, sizeof(protoinfo), "Unknown protocol (%d) %s > %s: %s",
|
||||
hdr.proto, srchost, dsthost, ipinfo);
|
||||
} else {
|
||||
Snprintf(protoinfo, sizeof(protoinfo), "%s (%d) %s > %s: %s",
|
||||
nexthdrtoa(hdr.proto, 1), hdr.proto, srchost, dsthost, ipinfo);
|
||||
hdrstr, hdr.proto, srchost, dsthost, ipinfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user