summaryrefslogtreecommitdiff
path: root/src/v4l2/v4l2_camera_proxy.cpp
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2020-06-03 22:12:27 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2020-06-08 17:11:30 +0900
commitd072fd6e07487e20cbe4d781999e5c025702a091 (patch)
treee973eeca7046a095272e9cda3628d9cc97dc92f4 /src/v4l2/v4l2_camera_proxy.cpp
parent6e730695deef37b9a66bb9547df41d17d2872028 (diff)
v4l2: v4l2_camera_proxy: Fix bounds check for VIDIOC_ENUM_FMT
VIDIOC_ENUM_FMT is meant to return -EINVAL if the requested index is out of bounds. This bounds is obtained from the libcamera Camera's list of formats. The bounds check for this list was incorrect; fix it. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/v4l2/v4l2_camera_proxy.cpp')
-rw-r--r--src/v4l2/v4l2_camera_proxy.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 3df4d42b..ec6d265d 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -224,7 +224,7 @@ int V4L2CameraProxy::vidioc_enum_fmt(struct v4l2_fmtdesc *arg)
LOG(V4L2Compat, Debug) << "Servicing vidioc_enum_fmt";
if (!validateBufferType(arg->type) ||
- arg->index > streamConfig_.formats().pixelformats().size())
+ arg->index >= streamConfig_.formats().pixelformats().size())
return -EINVAL;
/* \todo Add map from format to description. */