media: v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args()
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 21 Mar 2022 08:33:56 +0000 (08:33 +0000)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Tue, 27 Sep 2022 08:24:43 +0000 (10:24 +0200)
The v4l2_compat_get_array_args() function can leave uninitialized memory in the
buffer it is passed. So zero it before copying array elements from userspace
into the buffer.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: syzbot+ff18193ff05f3f87f226@syzkaller.appspotmail.com
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/v4l2-core/v4l2-compat-ioctl32.c

index 0f3d6b5..55c26e7 100644 (file)
@@ -1040,6 +1040,8 @@ int v4l2_compat_get_array_args(struct file *file, void *mbuf,
 {
        int err = 0;
 
+       memset(mbuf, 0, array_size);
+
        switch (cmd) {
        case VIDIOC_G_FMT32:
        case VIDIOC_S_FMT32: