Skip to content

Commit d8c6a5e

Browse files
committed
rtnr: clamp control switch element count
The switch get handler looped over a host-supplied element count while writing the reply channel array. 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 d8c6a5e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/audio/rtnr/rtnr.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,11 @@ static int rtnr_get_config(struct processing_module *mod,
454454
return rtnr_get_bin_data(mod, cdata, fragment_size);
455455

456456
case SOF_CTRL_CMD_SWITCH:
457+
if (cdata->num_elems > SOF_IPC_MAX_CHANNELS) {
458+
comp_err(dev, "rtnr_get_config() error: num_elems %u out of range",
459+
cdata->num_elems);
460+
return -EINVAL;
461+
}
457462
for (j = 0; j < cdata->num_elems; j++) {
458463
cdata->chanv[j].channel = j;
459464
cdata->chanv[j].value = cd->process_enable;

0 commit comments

Comments
 (0)