Similar to commit<ea72fbf588ac>("media: v4l2-compat-ioctl32: prevent go past max size"} ,add max size check for count variable. Signed-off-by: Defang Bo <bodefang@xxxxxxx> --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index a99e82e..5041d60 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -207,7 +207,7 @@ static int put_v4l2_window32(struct v4l2_window __user *p64, get_user(clipcount, &p64->clipcount) || put_user(clipcount, &p32->clipcount)) return -EFAULT; - if (!clipcount) + if (!clipcount || count > (U32_MAX/sizeof(*uclips))) return 0; if (get_user(kclips, &p64->clips)) -- 1.9.1