Michael Hennerich 7ccd4506fa IIO: Documentation: iio_utils: Prevent buffer overflow
The first part of build_channel_array()identifies the number of enabled channels.
Further down this count is used to allocate the ci_array. The next section parses the
scan_elements directory again, and fills ci_array regardless if the channel is enabled or not.
So if less than available channels are enabled ci_array memory is overflowed.

This fix makes sure that we allocate enough memory. But the whole approach looks a bit
cumbersome to me. Why not allocate memory for MAX_CHANNLES, less say 64
(I never seen a part with more than that channels). And skip the first part entirely.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-28 14:40:23 -08:00
..
2011-02-15 15:25:48 -05:00
2011-02-23 14:39:10 -08:00
2011-01-13 08:03:09 -08:00
2011-01-20 21:37:29 +10:30
2011-01-12 04:59:44 -05:00
2011-01-26 10:50:00 +10:00
2011-01-12 05:14:15 -05:00
2011-02-01 16:48:46 +02:00