summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibIPC
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-05-24 09:04:22 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-24 09:04:22 +0200
commitd3f298c592f81ac6ea0bd42932da551fd8a50730 (patch)
tree5986ef47a8bf9023a8df6618dc1f67b030e6a0ae /Userland/Libraries/LibIPC
parent8f2425125e79240d2ff9161297438b4012de826f (diff)
downloadserenity-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.h4
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);