Skip to content

Commit ecd6c61

Browse files
trunghieulenxpkartben
authored andcommitted
drivers: video: ov5640: Fix bug out-of-bound buffer read
Fix the out of bound buffer read by checking the lower-bound index in the ov5640_enum_frmival function. Signed-off-by: Trung Hieu Le <[email protected]>
1 parent 401a8a2 commit ecd6c61

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/video/ov5640.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,8 +903,7 @@ static int ov5640_enum_frmival(const struct device *dev, enum video_endpoint_id
903903
break;
904904
}
905905
}
906-
907-
if (i == ARRAY_SIZE(modes) || fie->index > ARRAY_SIZE(ov5640_frame_rates) ||
906+
if (i == ARRAY_SIZE(modes) || fie->index >= ARRAY_SIZE(ov5640_frame_rates) ||
908907
ov5640_frame_rates[fie->index] > modes[i].max_frmrate) {
909908
return -EINVAL;
910909
}

0 commit comments

Comments
 (0)