audio/selector: Don't assert on input-controllable memcpy_s failure

The size argument to the memcpy_s() here is under the control of
external data and can fail on garbage.  That needs to be a runtime
failure, not an assertion.

Signed-off-by: Andy Ross <andyross@google.com>
This commit is contained in:
Andy Ross 2023-06-22 12:00:39 -07:00 committed by Liam Girdwood
parent f449a22cc7
commit 98e6c6625f
1 changed files with 5 additions and 1 deletions

View File

@ -193,7 +193,11 @@ static struct comp_dev *selector_new(const struct comp_driver *drv,
comp_set_drvdata(dev, cd);
ret = memcpy_s(&cd->config, sizeof(cd->config), ipc_process->data, bs);
assert(!ret);
if (ret) {
rfree(cd);
rfree(dev);
return NULL;
}
dev->state = COMP_STATE_READY;
return dev;