All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tuner-simple: possible read buffer overflow?
@ 2009-10-03 19:02 Roel Kluin
  2009-10-03 19:07 ` Trent Piepho
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-10-03 19:02 UTC (permalink / raw)
  To: mchehab, linux-media, Andrew Morton

Prevent read from t_params->ranges[-1].

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
This is only required when t_params->count can be 0, can it?

Roel

diff --git a/drivers/media/common/tuners/tuner-simple.c b/drivers/media/common/tuners/tuner-simple.c
index 8abbcc5..e679d5f 100644
--- a/drivers/media/common/tuners/tuner-simple.c
+++ b/drivers/media/common/tuners/tuner-simple.c
@@ -266,7 +266,7 @@ static int simple_config_lookup(struct dvb_frontend *fe,
 			continue;
 		break;
 	}
-	if (i == t_params->count) {
+	if (i == t_params->count && i) {
 		tuner_dbg("frequency out of range (%d > %d)\n",
 			  *frequency, t_params->ranges[i - 1].limit);
 		*frequency = t_params->ranges[--i].limit;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-03 19:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-03 19:02 [PATCH] tuner-simple: possible read buffer overflow? Roel Kluin
2009-10-03 19:07 ` Trent Piepho

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.