]> git.karo-electronics.de Git - karo-tx-linux.git/commit
iio: Fix a buffer overflow in iio_utils.h example code
authorCraig Markwardt <>
Wed, 1 Jan 2014 15:38:52 +0000 (15:38 +0000)
committerJonathan Cameron <jic23@kernel.org>
Wed, 1 Jan 2014 15:48:58 +0000 (15:48 +0000)
commit66c65d90db1004356281db6ead988e2e38ba9e37
tree5f303f7f64af375931a93519da982c62f41caddf
parente9ed104de68c345c9a827225e93c74c6894613a9
iio: Fix a buffer overflow in iio_utils.h example code

This was originally reported by Craig Markwardt on Zubair Lutfullah's
blog and Zubair forwarded it to linux-iio@vger.kernel.org. No email
address known.

The code first counted the number of enabled channels, then created an
array to hold information about them.  The code that filled this array then
stored whether a given element was enabled inside the array.  Curriously
this element was never used.  Craig's patch added a local temporary variable
to avoid the buffer overrun.  Jonathan then removed the original enabled
element of the structure as it was not needed at all.

Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/Documentation/iio_utils.h