From 8e2d1b358c91b7e91fb8aa093a2e5bb2ee474564 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Tue, 18 Mar 2025 17:05:06 -0400 Subject: [PATCH] [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. --- base/applications/network/ping/ping.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/base/applications/network/ping/ping.c b/base/applications/network/ping/ping.c index 17afdfc5738..d0ebc0397ae 100644 --- a/base/applications/network/ping/ping.c +++ b/base/applications/network/ping/ping.c @@ -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)