diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-24 09:04:22 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-24 09:04:22 +0200 |
commit | d3f298c592f81ac6ea0bd42932da551fd8a50730 (patch) | |
tree | 5986ef47a8bf9023a8df6618dc1f67b030e6a0ae /Userland/Libraries/LibIPC | |
parent | 8f2425125e79240d2ff9161297438b4012de826f (diff) | |
download | serenity-d3f298c592f81ac6ea0bd42932da551fd8a50730.zip |
LibIPC: Fix unaligned u32 access in drain_messages_from_peer()
Caught by userspace UBSAN. :^)
Diffstat (limited to 'Userland/Libraries/LibIPC')
-rw-r--r-- | Userland/Libraries/LibIPC/Connection.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibIPC/Connection.h b/Userland/Libraries/LibIPC/Connection.h index 555b5e67df..3ac101c69a 100644 --- a/Userland/Libraries/LibIPC/Connection.h +++ b/Userland/Libraries/LibIPC/Connection.h @@ -207,9 +207,9 @@ protected: } size_t index = 0; - uint32_t message_size = 0; + u32 message_size = 0; for (; index + sizeof(message_size) < bytes.size(); index += message_size) { - message_size = *reinterpret_cast<uint32_t*>(bytes.data() + index); + memcpy(&message_size, bytes.data() + index, sizeof(message_size)); if (message_size == 0 || bytes.size() - index - sizeof(uint32_t) < message_size) break; index += sizeof(message_size); |