mirror of
https://github.com/nmap/nmap.git
synced 2025-12-17 13:09:02 +00:00
Fix the test for an IPv4 packet in readip_pcap. It was checking this condition:
(*p & 0x40) == 0x40 But that doesn't check that the upper half of the byte is 4. It's true for 4, 5, 6, 7, 12, 13, 14, and 15. I changed it to (*p & 0xF0) == 0x40
This commit is contained in:
4
tcpip.cc
4
tcpip.cc
@@ -2342,7 +2342,7 @@ char *readip_pcap(pcap_t *pd, unsigned int *len, long to_usec,
|
|||||||
}
|
}
|
||||||
p += offset;
|
p += offset;
|
||||||
}
|
}
|
||||||
if (!p || (*p & 0x40) != 0x40) {
|
if (!p || (*p & 0xF0) != 0x40) {
|
||||||
/* Should we timeout? */
|
/* Should we timeout? */
|
||||||
if (to_usec == 0) {
|
if (to_usec == 0) {
|
||||||
timedout = 1;
|
timedout = 1;
|
||||||
@@ -2353,7 +2353,7 @@ char *readip_pcap(pcap_t *pd, unsigned int *len, long to_usec,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!timedout && (!p || (*p & 0x40) != 0x40)); /* Go until we get IPv4 packet */
|
} while (!timedout && (!p || (*p & 0xF0) != 0x40)); /* Go until we get IPv4 packet */
|
||||||
|
|
||||||
if (timedout) {
|
if (timedout) {
|
||||||
*len = 0;
|
*len = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user