From 73a55007a44d23be40be681c4882fd6ad1e30b60 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 19 Jun 2021 13:12:34 +0200 Subject: Improved bus and device management --- libs/libgui/msg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libs') 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 -- cgit v1.2.3