From e349f0ad3d361b44c202df69a56dc842e69f1efc Mon Sep 17 00:00:00 2001 From: pjht Date: Wed, 28 Aug 2019 20:24:53 -0500 Subject: [PATCH] Add protection againt sending to mailbox 0 --- kernel/cpu/i386/mailboxes.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/cpu/i386/mailboxes.c b/kernel/cpu/i386/mailboxes.c index 8d74af3..a3fe551 100644 --- a/kernel/cpu/i386/mailboxes.c +++ b/kernel/cpu/i386/mailboxes.c @@ -28,6 +28,10 @@ void kernel_mailbox_free(uint32_t box) { } void kernel_mailbox_send_msg(Message* user_msg) { + if (user_msg->to==0) { + serial_printf("Box %d attempted to send to box 0!\n",user_msg->from); + return; + } Mailbox mailbox=mailboxes[user_msg->to]; char* msg_data=kmalloc(user_msg->size); memcpy(msg_data,user_msg->msg,user_msg->size);