In the Linux kernel, the following vulnerability has been resolved:
iio: dac: ad3552r-hs: fix out-of-bound write in ad3552r_hs_write_data_source
When simple_write_to_buffer() succeeds, it returns the number of bytes actually copied to the buffer. The code incorrectly uses 'count' as the index for null termination instead of the actual bytes copied. If count exceeds the buffer size, this leads to out-of-bounds write. Add a check for the count and use the return value as the index.
The bug was validated using a demo module that mirrors the original code and was tested under QEMU.
Pattern of the bug:
Steps for reproduce:
Found via static analysis. This is similar to the commit da9374819eb3 ("iio: backend: fix out-of-bound write")