diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-08-25 17:32:01 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-30 17:35:27 +0200 |
commit | 852454746ea6a6015aa346ef056e5c87ced3a015 (patch) | |
tree | 0a1569488a7ca38226b200eba24b44505fde81bd /Userland/ping.cpp | |
parent | be6cce5530eac99c8b9c6291e01f600a42ac18f5 (diff) | |
download | serenity-852454746ea6a6015aa346ef056e5c87ced3a015.zip |
Everywhere: Port to String::copy_characters_to_buffer()
Diffstat (limited to 'Userland/ping.cpp')
-rw-r--r-- | Userland/ping.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/ping.cpp b/Userland/ping.cpp index 9096d0e470..d8248cb094 100644 --- a/Userland/ping.cpp +++ b/Userland/ping.cpp @@ -125,7 +125,10 @@ int main(int argc, char** argv) ping_packet.header.code = 0; ping_packet.header.un.echo.id = htons(pid); ping_packet.header.un.echo.sequence = htons(seq++); - strlcpy(ping_packet.msg, "Hello there!\n", sizeof(ping_packet.msg)); + + bool fits = String("Hello there!\n").copy_characters_to_buffer(ping_packet.msg, sizeof(ping_packet.msg)); + // It's a constant string, we can be sure that it fits. + ASSERT(fits); ping_packet.header.checksum = internet_checksum(&ping_packet, sizeof(PingPacket)); |