From ec3e25bf03e7bff741d75e94d311dd0af51534f0 Mon Sep 17 00:00:00 2001 From: Debasis Das Date: Tue, 25 Aug 2020 15:22:33 +0530 Subject: [PATCH] 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 --- target_if/spectral/target_if_spectral_phyerr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target_if/spectral/target_if_spectral_phyerr.c b/target_if/spectral/target_if_spectral_phyerr.c index 471cc8bcd458..a7416d77a860 100644 --- a/target_if/spectral/target_if_spectral_phyerr.c +++ b/target_if/spectral/target_if_spectral_phyerr.c @@ -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;