aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/libgui/msg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/libgui/msg.c b/libs/libgui/msg.c
index a8da87c..16f72d4 100644
--- a/libs/libgui/msg.c
+++ b/libs/libgui/msg.c
@@ -35,8 +35,11 @@ res msg_send(enum message_type type, void *data, u32 size)
res msg_receive(void *buf, u32 size)
{
- res ret = dev_read(DEV_BUS, buf, 0, size);
+ assert(size >= sizeof(struct message_header));
struct message_header *header = buf;
+ memset(header, 0, sizeof(*header));
+
+ res ret = dev_read(DEV_BUS, buf, 0, size);
if (header->magic == MSG_MAGIC)
return ret;
else