OSDN Git Service

[media] zc3xx: don't go past quality array
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 28 Apr 2015 22:39:53 +0000 (19:39 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 30 Apr 2015 17:27:15 +0000 (14:27 -0300)
drivers/media/usb/gspca/zc3xx.c:6363 zcxx_s_ctrl() error: buffer overflow 'jpeg_qual' 3 <= 3

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/gspca/zc3xx.c

index d3e1b6d..3762a04 100644 (file)
@@ -6360,7 +6360,7 @@ static int zcxx_s_ctrl(struct v4l2_ctrl *ctrl)
                        if (ctrl->val <= jpeg_qual[i])
                                break;
                }
-               if (i > 0 && i == qual && ctrl->val < jpeg_qual[i])
+               if (i == ARRAY_SIZE(jpeg_qual) || (i > 0 && i == qual && ctrl->val < jpeg_qual[i]))
                        i--;
 
                /* With high quality settings we need max bandwidth */