Fix a buffer overflow
The existing check accepts the number of array elements as a valid index. That's clearly wrong for zero based indexing, and would result in a buffer overflow.
This commit is contained in:
parent
469d3ee177
commit
c6ea7afb76
@ -333,7 +333,7 @@ liquivision_lynx_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
|
||||
// Get the sample interval.
|
||||
unsigned int interval_idx = data[39];
|
||||
const unsigned int intervals[] = {1, 2, 5, 10, 30, 60};
|
||||
if (interval_idx > C_ARRAY_SIZE(intervals)) {
|
||||
if (interval_idx >= C_ARRAY_SIZE(intervals)) {
|
||||
ERROR (abstract->context, "Invalid sample interval index %u", interval_idx);
|
||||
return DC_STATUS_DATAFORMAT;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user