mirror of https://github.com/thesofproject/sof.git
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:
parent
aef54e4066
commit
cc0f713e75
|
@ -122,8 +122,8 @@ struct sof_ipc_cmd_hdr *mailbox_validate(void)
|
||||||
mailbox_hostbox_read(hdr, SOF_IPC_MSG_MAX_SIZE, 0, sizeof(*hdr));
|
mailbox_hostbox_read(hdr, SOF_IPC_MSG_MAX_SIZE, 0, sizeof(*hdr));
|
||||||
|
|
||||||
/* validate component header */
|
/* validate component header */
|
||||||
if (hdr->size > SOF_IPC_MSG_MAX_SIZE) {
|
if (hdr->size < sizeof(*hdr) || hdr->size > SOF_IPC_MSG_MAX_SIZE) {
|
||||||
tr_err(&ipc_tr, "ipc: msg too big at 0x%x", hdr->size);
|
tr_err(&ipc_tr, "ipc: invalid size 0x%x", hdr->size);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue