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

Submitted by Mark Thompson on Oct. 23, 2018, 9:48 p.m.

Details

Message ID 20181023214826.31994-1-sw@jkqxz.net
State New
Headers show

Commit Message

Mark Thompson Oct. 23, 2018, 9:48 p.m.
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(-)

Patch hide | download patch | download mbox

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;