Skip to contentSkip to conversation

media: dvb-frontends: Fix out of bound for buffer

PATCH New Ilya Krutskih 1 participant 1 message Dec 11, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 media: dvb-frontends: Fix out of bound for buffer

Result of pointer shifting is out of bound for buffer 'prev_swp_freq' because of incrementation inside 'while' cycle in case more than 20 steps of it.

Add check: prev_freq_num < 20

Cc [email protected] # v5.10+
Fixes 9a0bf528b4d6 ([media] move the dvb/frontends to drivers/media/dvb-frontends)
---
 drivers/media/dvb-frontends/mb86a16.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/mb86a16.c +1 -1
index 9033e39d75f4..da8985b91475 100644
@@ -1188,7 +1188,7 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
 
 			signal_dupl = 0;
 			for (j = 0; j < prev_freq_num; j++) {
-				if ((abs(prev_swp_freq[j] - swp_freq)) < (swp_ofs * 3 / 2)) {
+				if ((prev_freq_num < 20) && (abs(prev_swp_freq[j] - swp_freq)) < (swp_ofs * 3 / 2)) {
 					signal_dupl = 1;
 					dprintk(verbose, MB86A16_INFO, 1, "Probably Duplicate Signal, j = %d", j);
 				}
Signature · 1 line
2.43.0