[PING] Update SendBuffer fill method (#7782)

The ping utility found in various versions of Windows fills the optional
data field in the ICMP echo request structure with ASCII characters from
'a' to 'w' wrapping back around until SendBuffer is full.

Future TO-DO: Compare ReplyBuffer data to SendBuffer.
This commit is contained in:
Curtis Wilson
2025-03-18 17:05:06 -04:00
committed by GitHub
parent 787f81f3f5
commit 8e2d1b358c

View File

@@ -432,7 +432,11 @@ Ping(void)
exit(1);
}
ZeroMemory(SendBuffer, RequestSize);
/* Windows ping utility fills the optional data field with
* ASCII characters from 'a' to 'w', wrapping back around
* until SendBuffer is full. */
for (ULONG i = 0; i < RequestSize; i++)
((PUCHAR)SendBuffer)[i] = (UCHAR)('a' + (i % ('w' - 'a' + 1)));
}
if (Family == AF_INET6)
@@ -483,6 +487,7 @@ Ping(void)
ReplyBuffer, ReplySize, Timeout);
}
/* TODO: Compare ReplyBuffer data to SendBuffer. */
free(SendBuffer);
if (Status == 0)