]> sigrok.org Git - libsigrok.git/commitdiff
asix-sigma: fix out-of-range access to the samplerates[] array
authorGerhard Sittig <redacted>
Sun, 16 Oct 2016 16:25:19 +0000 (18:25 +0200)
committerUwe Hermann <redacted>
Mon, 17 Oct 2016 00:05:21 +0000 (02:05 +0200)
Commit 2c9c0df86eaf removed the sentinel from the samplerates[] array,
but did not adjust the test which checked whether a rate is listed in
the set of supported rates. This could result in an out-of-range access
beyond the array's last item.

Fix the "listed?" check after iterating the table of supported rates.
Cope with either presence or absence of a sentinel in the array.

Address some more style nits while we are here. Rename an identifier
for a local variable which unintentionally might suggest that it would
be a preprocessor macro (all-caps). Reduce redundancy in data type
references as well as in the determination of the array size.

Signed-off-by: Gerhard Sittig <redacted>

No differences found