Skip to content

Commit a0e659f

Browse files
committed
audio: copier: fix memcpy_s dest_size in copier_set_gain
The first memcpy_s call passed gain_coef_size (= channels * sizeof(uint16_t), host-controlled) as the dest_size argument, defeating the bounds check. Pass sizeof(static_gain) — the true buffer capacity so memcpy_s can enforce the limit. Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
1 parent 3c51666 commit a0e659f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/audio/copier/copier_gain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ int copier_set_gain(struct comp_dev *dev, struct copier_gain_params *gain_params
182182

183183
size_t gain_coef_size = channels * sizeof(uint16_t);
184184

185-
ret = memcpy_s(static_gain, gain_coef_size, gain_data->gain_coeffs,
185+
ret = memcpy_s(static_gain, sizeof(static_gain), gain_data->gain_coeffs,
186186
gain_coef_size);
187187
if (ret) {
188188
comp_err(dev, "memcpy_s failed with error %d", ret);

0 commit comments

Comments
 (0)