1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

Userland: Use INET_ADDRSTRLEN for inet_ntop() buffers

There's no point in using different, seemingly randomly sized buffers as
the required size for storing an IPv4 address representation is well
known (16 bytes).
This commit is contained in:
Linus Groh 2021-02-09 22:35:00 +01:00 committed by Andreas Kling
parent f24b674d7a
commit 1fd349b8c2
3 changed files with 4 additions and 4 deletions

View file

@ -221,7 +221,7 @@ int main(int argc, char** argv)
else if (ms > max_ms)
max_ms = ms;
char addr_buf[64];
char addr_buf[INET_ADDRSTRLEN];
printf("Pong from %s: id=%u, seq=%u%s, time=%dms\n",
inet_ntop(AF_INET, &peer_address.sin_addr, addr_buf, sizeof(addr_buf)),
ntohs(pong_packet.header.un.echo.id),