Skip to contentSkip to conversation

stk-webcam: Read buffer overflow

PATCH New Roel Kluin 1 participant 1 message Jul 24, 2009 Media (V4L/DVB)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 stk-webcam: Read buffer overflow

It tested the value of stk_sizes[i].m before checking whether i was in range.

---

drivers/media/video/stk-webcam.c +2 -2
index 4d6785e..b154bd9 100644
@@ -1050,8 +1050,8 @@ static int stk_setup_format(struct stk_camera *dev)
 		depth = 1;
 	else
 		depth = 2;
-	while (stk_sizes[i].m != dev->vsettings.mode
-			&& i < ARRAY_SIZE(stk_sizes))
+	while (i < ARRAY_SIZE(stk_sizes) &&
+			stk_sizes[i].m != dev->vsettings.mode)
 		i++;
 	if (i == ARRAY_SIZE(stk_sizes)) {
 		STK_ERROR("Something is broken in %s\n", __func__);