mirror of
https://github.com/nmap/nmap.git
synced 2026-08-03 22:29:06 +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:
parent
c1e1a12e2c
commit
49c6b65a5a
1 changed files with 5 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue