Skip to content

Commit

Permalink
ipc: header size validation fix
Browse files Browse the repository at this point in the history
This patch will deny IPC headers with size 0

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
  • Loading branch information
abonislawski authored and jajanusz committed Jun 5, 2020
1 parent 6581428 commit 88707ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ipc/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,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) {
trace_ipc_error("ipc: msg too big at 0x%x", hdr->size);
if (hdr->size < sizeof(*hdr) || hdr->size > SOF_IPC_MSG_MAX_SIZE) {
trace_ipc_error("ipc: invalid size 0x%x", hdr->size);
return NULL;
}

Expand Down

0 comments on commit 88707ca

Please sign in to comment.