mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
In build_{icmp,igmp}_raw, fill with zeros when data is NULL.
This restores the previous behavior of these functions, which was broken in r24127, which itself was fixing another bug. r24127 solved the problem of --data-length appending zeroes, not random data, to ICMP and IGMP packets. But in doing so, it added a check that the data argument is not NULL. OS detection uses a data argument of NULL, expecting these functions to fill in zeroes in this case. The result of this was that the IE probes were being sent with empty payloads instead of 120 and 150 bytes.
This commit is contained in:
parent
1c67d5e508
commit
8b01344caf
1 changed files with 10 additions and 5 deletions
15
tcpip.cc
15
tcpip.cc
|
|
@ -1034,9 +1034,12 @@ u8 *build_icmp_raw(const struct in_addr *source,
|
|||
}
|
||||
|
||||
/* Copy the data over too */
|
||||
if (data && datalen) {
|
||||
if (datalen > 0) {
|
||||
icmplen += MIN(dlen, datalen);
|
||||
memcpy(datastart, data, MIN(dlen, datalen));
|
||||
if (data == NULL)
|
||||
memset(datastart, 0, MIN(dlen, datalen));
|
||||
else
|
||||
memcpy(datastart, data, MIN(dlen, datalen));
|
||||
}
|
||||
|
||||
/* Fill out the ping packet. All the ICMP types handled by this function have
|
||||
|
|
@ -1140,10 +1143,12 @@ u8 *build_igmp_raw(const struct in_addr *source,
|
|||
fatal("Unknown igmp type (%d) in %s", ptype, __func__);
|
||||
}
|
||||
|
||||
/* Copy the data over too */
|
||||
if (data && datalen) {
|
||||
if (datalen > 0) {
|
||||
igmplen += MIN(dlen, datalen);
|
||||
memcpy(datastart, data, MIN(dlen, datalen));
|
||||
if (data == NULL)
|
||||
memset(datastart, 0, MIN(dlen, datalen));
|
||||
else
|
||||
memcpy(datastart, data, MIN(dlen, datalen));
|
||||
}
|
||||
|
||||
igmp.igmp_cksum = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue