pkarashchenko commented on code in PR #6280:
URL: https://github.com/apache/incubator-nuttx/pull/6280#discussion_r877255704


##########
drivers/video/video.c:
##########
@@ -989,6 +1085,33 @@ static int video_close(FAR struct file *filep)
   return ret;
 }
 
+static int video_querycap(FAR struct v4l2_capability *cap)
+{
+  FAR const char *name;
+
+  ASSERT(g_video_sensor_ops);
+
+  if (cap == NULL)
+    {
+      return -EINVAL;
+    }
+
+  if (g_video_sensor_ops->get_driver_name == NULL)
+    {
+      return -ENOTTY;
+    }
+
+  name = g_video_sensor_ops->get_driver_name();
+
+  memset(cap, 0, sizeof(struct v4l2_capability));
+
+  /* cap->driver needs to be NULL-terminated. */
+
+  strncpy((FAR char *)cap->driver, name, sizeof(cap->driver) - 1);

Review Comment:
   Maybe can use strlcpy instead?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to