On 2/24/2021 10:38 PM, Guo, Yejun wrote:
Here is the warning message:
src/libavdevice/v4l2.c: In function ‘v4l2_get_device_list’:
src/libavdevice/v4l2.c:1054:58: warning: ‘%s’ directive output may be truncated 
writing up to 255 bytes into a region of size 251 [-Wformat-truncation=]
          snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
                                                           ^~
src/libavdevice/v4l2.c:1054:9: note: ‘snprintf’ output between 6 and 261 bytes 
into a destination of size 256
          snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Guo, Yejun <yejun....@intel.com>
---
  libavdevice/v4l2.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 365bacd771..e11d10d20e 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -1046,7 +1046,7 @@ static int v4l2_get_device_list(AVFormatContext *ctx, 
AVDeviceInfoList *device_l
          return ret;
      }
      while ((entry = readdir(dir))) {
-        char device_name[256];
+        char device_name[512];

Is there a portable path max constant that would be better for cases like this, rather than just picking another arbitrary buffer size?


if (!v4l2_is_v4l_dev(entry->d_name))
              continue;

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to