V4L/DVB: omap24xxcam: potential buffer overflow
authorDan Carpenter <[email protected]>
Wed, 10 Mar 2010 10:57:03 +0000 (07:57 -0300)
committerMauro Carvalho Chehab <[email protected]>
Thu, 6 May 2010 22:18:58 +0000 (19:18 -0300)
The previous loop goes until last == VIDEO_MAX_FRAME, so this could
potentially go one past the end of the loop.

Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Sakari Ailus <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
drivers/media/video/omap24xxcam.c

index b189fe63394b79a0364d9fd0b3f6dd94dab93a8f..ce76d952e1613682b1948762d6be26caffee21b4 100644 (file)
@@ -1405,7 +1405,7 @@ static int omap24xxcam_mmap_buffers(struct file *file,
        }
 
        size = 0;
-       for (i = first; i <= last; i++) {
+       for (i = first; i <= last && i < VIDEO_MAX_FRAME; i++) {
                struct videobuf_dmabuf *dma = videobuf_to_dma(vbq->bufs[i]);
 
                for (j = 0; j < dma->sglen; j++) {