qcacmn: Fix array index out of bounds

The 2nd argument passed to the function is_primaryseg_expected
is used to index the array spectral->rparams.fragmentation_160 which
is of size 2.If the value of the argument is greater than or equal
to 2, the indexing will lead to array-out-of-bounds access.
The fix is adding the relevant validation check.

Change-Id: Iccf98b06c0546ad11ec67e93e14183214100107f
This commit is contained in:
Debasis Das 2020-08-25 15:22:33 +05:30 • committed by snandini
commit ec3e25bf03

View file

@ -1877,7 +1877,7 @@ target_if_consume_spectral_report_gen3(
spectral_mode = target_if_get_spectral_mode(detector_id,
&spectral->rparams);
if (spectral_mode == SPECTRAL_SCAN_MODE_INVALID) {
if (spectral_mode >= SPECTRAL_SCAN_MODE_MAX) {
spectral_err_rl("No valid Spectral mode for detector id %u",
detector_id);
goto fail;