提交 0123f29c 编写于 作者: O Ole Ernst 提交者: Mauro Carvalho Chehab

[media] dvb_frontend: Fix possible read out of bounds

Check if index is within bounds _before_ accessing the value.
Signed-off-by: NOle Ernst <olebowle@gmx.com>
Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
上级 2f9dff3f
...@@ -1279,7 +1279,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe, ...@@ -1279,7 +1279,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
switch(tvp->cmd) { switch(tvp->cmd) {
case DTV_ENUM_DELSYS: case DTV_ENUM_DELSYS:
ncaps = 0; ncaps = 0;
while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) { while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) {
tvp->u.buffer.data[ncaps] = fe->ops.delsys[ncaps]; tvp->u.buffer.data[ncaps] = fe->ops.delsys[ncaps];
ncaps++; ncaps++;
} }
...@@ -1596,7 +1596,7 @@ static int dvbv5_set_delivery_system(struct dvb_frontend *fe, ...@@ -1596,7 +1596,7 @@ static int dvbv5_set_delivery_system(struct dvb_frontend *fe,
* supported * supported
*/ */
ncaps = 0; ncaps = 0;
while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) { while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) {
if (fe->ops.delsys[ncaps] == desired_system) { if (fe->ops.delsys[ncaps] == desired_system) {
c->delivery_system = desired_system; c->delivery_system = desired_system;
dev_dbg(fe->dvb->device, dev_dbg(fe->dvb->device,
...@@ -1628,7 +1628,7 @@ static int dvbv5_set_delivery_system(struct dvb_frontend *fe, ...@@ -1628,7 +1628,7 @@ static int dvbv5_set_delivery_system(struct dvb_frontend *fe,
* of the desired system * of the desired system
*/ */
ncaps = 0; ncaps = 0;
while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) { while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) {
if (dvbv3_type(fe->ops.delsys[ncaps]) == type) if (dvbv3_type(fe->ops.delsys[ncaps]) == type)
delsys = fe->ops.delsys[ncaps]; delsys = fe->ops.delsys[ncaps];
ncaps++; ncaps++;
...@@ -1703,7 +1703,7 @@ static int dvbv3_set_delivery_system(struct dvb_frontend *fe) ...@@ -1703,7 +1703,7 @@ static int dvbv3_set_delivery_system(struct dvb_frontend *fe)
* DVBv3 standard * DVBv3 standard
*/ */
ncaps = 0; ncaps = 0;
while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) { while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) {
if (dvbv3_type(fe->ops.delsys[ncaps]) != DVBV3_UNKNOWN) { if (dvbv3_type(fe->ops.delsys[ncaps]) != DVBV3_UNKNOWN) {
delsys = fe->ops.delsys[ncaps]; delsys = fe->ops.delsys[ncaps];
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册