aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorMarvin Borner2021-06-19 13:12:34 +0200
committerMarvin Borner2021-06-19 13:12:34 +0200
commit73a55007a44d23be40be681c4882fd6ad1e30b60 (patch)
tree87f37dff42d8ae51dbb2250f1752a03081298cc3 /libs
parent02a0c882275959c0fbd58754418ecc1218821e76 (diff)
Improved bus and device management
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