]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[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 d3e1b6d8bf494f79d449c38c96be5d022ab61043..3762a045f7449e58eb8cbe880729c0c4f31c9db6 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 */