diff mbox

[5/9] drivers/media/video/bw-qcam.c: fix read buffer overflow

Message ID 200908062301.n76N1G6Z029973@imap1.linux-foundation.org (mailing list archive)
State Accepted
Delegated to: Douglas Landgraf
Headers show

Commit Message

Andrew Morton Aug. 6, 2009, 11:01 p.m. UTC
From: Roel Kluin <roel.kluin@gmail.com>

parport[n] is checked before n < MAX_CAMS

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/media/video/bw-qcam.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff -puN drivers/media/video/bw-qcam.c~drivers-media-video-bw-qcamc-fix-read-buffer-overflow drivers/media/video/bw-qcam.c
--- a/drivers/media/video/bw-qcam.c~drivers-media-video-bw-qcamc-fix-read-buffer-overflow
+++ a/drivers/media/video/bw-qcam.c
@@ -992,7 +992,7 @@  static int accept_bwqcam(struct parport 
 
 	if (parport[0] && strncmp(parport[0], "auto", 4) != 0) {
 		/* user gave parport parameters */
-		for(n=0; parport[n] && n<MAX_CAMS; n++){
+		for (n = 0; n < MAX_CAMS && parport[n]; n++) {
 			char *ep;
 			unsigned long r;
 			r = simple_strtoul(parport[n], &ep, 0);