[FFmpeg-devel] [PATCH 1/2] lavd/v4l2: Avoid warning about path length

Mark Thompson sw at jkqxz.net
Wed Oct 24 00:48:25 EEST 2018


GCC warns about the name being truncated here - in theory it will
indeed behave unexpectedly if the user has a device in /dev with a
255 character name beginning with "video", but this is probably a
niche use-case.
---
 libavdevice/v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 10a0ff0dd6..ba2505769d 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -1042,7 +1042,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[sizeof(entry->d_name) + 8];
 
         if (!v4l2_is_v4l_dev(entry->d_name))
             continue;
-- 
2.19.1



More information about the ffmpeg-devel mailing list