Skip to content

Commit 7c113eb

Browse files
committed
igo_nr: clamp control switch element count
The switch get handler looped over a host-supplied element count while writing the reply channel array and reading per-channel state. Reject counts larger than the maximum channel count before the loop. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 3f7738d commit 7c113eb

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/audio/igo_nr/igo_nr.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,11 @@ static int igo_nr_get_config(struct processing_module *mod,
566566
comp_info(dev, "SOF_CTRL_CMD_BINARY");
567567
return comp_data_blob_get_cmd(cd->model_handler, cdata, fragment_size);
568568
case SOF_CTRL_CMD_SWITCH:
569+
if (cdata->num_elems > SOF_IPC_MAX_CHANNELS) {
570+
comp_err(dev, "igo_nr_get_config() error: num_elems %u out of range",
571+
cdata->num_elems);
572+
return -EINVAL;
573+
}
569574
for (j = 0; j < cdata->num_elems; j++) {
570575
cdata->chanv[j].channel = j;
571576
cdata->chanv[j].value = cd->process_enable[j];

0 commit comments

Comments
 (0)