Skip to content

Commit 86f56a2

Browse files
committed
rtnr: clamp control switch element count in set path
The switch set handler looped over a host-supplied element count reading the control channel array past the payload. Reject counts above the maximum channel count. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent d8c6a5e commit 86f56a2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/audio/rtnr/rtnr.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,12 @@ static int32_t rtnr_set_value(struct processing_module *mod, void *ctl_data)
565565
uint32_t val = 0;
566566
int32_t j;
567567

568+
if (cdata->num_elems > SOF_IPC_MAX_CHANNELS) {
569+
comp_err(dev, "rtnr_set_value() error: num_elems %u out of range",
570+
cdata->num_elems);
571+
return -EINVAL;
572+
}
573+
568574
for (j = 0; j < cdata->num_elems; j++) {
569575
val |= cdata->chanv[j].value;
570576
comp_dbg(dev, "value = %u", val);

0 commit comments

Comments
 (0)