ipc: header size validation fix

This patch will deny IPC headers with size 0

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
This commit is contained in:
Adrian Bonislawski 2020-06-05 10:47:30 +02:00 committed by Liam Girdwood
parent aef54e4066
commit cc0f713e75
1 changed files with 2 additions and 2 deletions

View File

@ -122,8 +122,8 @@ struct sof_ipc_cmd_hdr *mailbox_validate(void)
mailbox_hostbox_read(hdr, SOF_IPC_MSG_MAX_SIZE, 0, sizeof(*hdr));
/* validate component header */
if (hdr->size > SOF_IPC_MSG_MAX_SIZE) {
tr_err(&ipc_tr, "ipc: msg too big at 0x%x", hdr->size);
if (hdr->size < sizeof(*hdr) || hdr->size > SOF_IPC_MSG_MAX_SIZE) {
tr_err(&ipc_tr, "ipc: invalid size 0x%x", hdr->size);
return NULL;
}