From f8160bb3eecb62f4308e0f25a958404c584cb852 Mon Sep 17 00:00:00 2001 From: pjht Date: Sun, 1 Sep 2019 13:01:37 -0500 Subject: [PATCH] Fix IPC buffer size check --- kernel/cpu/i386/mailboxes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/cpu/i386/mailboxes.c b/kernel/cpu/i386/mailboxes.c index 6ac11f3..832999e 100644 --- a/kernel/cpu/i386/mailboxes.c +++ b/kernel/cpu/i386/mailboxes.c @@ -65,10 +65,11 @@ void kernel_mailbox_get_msg(uint32_t box, Message* recv_msg, uint32_t buffer_sz) recv_msg->from=mailbox.msg_store[mailbox.rd].from; recv_msg->to=mailbox.msg_store[mailbox.rd].to; recv_msg->size=mailbox.msg_store[mailbox.rd].size; - if (buffer_sz>mailbox.msg_store[mailbox.rd].size) { + if (buffer_szsize=mailbox.msg_store[mailbox.rd].size; recv_msg->from=0; serial_printf("Box %d attempted to get the message from box %d, but the buffer was too small.\n",box,mailbox.msg_store[mailbox.rd].from); + serial_printf("The message size is %d, and the buffer size is %d.\n",mailbox.msg_store[mailbox.rd].size,buffer_sz); mailboxes[box]=mailbox; return; }