• Anton Khirnov's avatar
    lavd/v4l2: detect device name truncation · 877b6a9e
    Anton Khirnov authored
    Silences the following warning with gcc 10:
    src/libavdevice/v4l2.c: In function ‘v4l2_get_device_list’:
    src/libavdevice/v4l2.c:1042:64: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 251 [-Wformat-truncation=]
     1042 |         ret = snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
          |                                                                ^~
    src/libavdevice/v4l2.c:1042:15: note: ‘snprintf’ output between 6 and 261 bytes into a destination of size 256
     1042 |         ret = snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
          |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Previous patches intending to silence it have proposed increasing the
    buffer size, but doing that correctly seems to be tricky. Failing on
    truncation is simpler and just as effective (as excessively long device
    names are unlikely).
    877b6a9e
Name
Last commit
Last update
..
tests Loading commit data...
.gitignore Loading commit data...
Makefile Loading commit data...
alldevices.c Loading commit data...
alsa.c Loading commit data...
alsa.h Loading commit data...
alsa_dec.c Loading commit data...
alsa_enc.c Loading commit data...
android_camera.c Loading commit data...
audiotoolbox.m Loading commit data...
avdevice.c Loading commit data...
avdevice.h Loading commit data...
avdeviceres.rc Loading commit data...
avfoundation.m Loading commit data...
bktr.c Loading commit data...
caca.c Loading commit data...
decklink_common.cpp Loading commit data...
decklink_common.h Loading commit data...
decklink_common_c.h Loading commit data...
decklink_dec.cpp Loading commit data...
decklink_dec.h Loading commit data...
decklink_dec_c.c Loading commit data...
decklink_enc.cpp Loading commit data...
decklink_enc.h Loading commit data...
decklink_enc_c.c Loading commit data...
dshow.c Loading commit data...
dshow_capture.h Loading commit data...
dshow_common.c Loading commit data...
dshow_crossbar.c Loading commit data...
dshow_enummediatypes.c Loading commit data...
dshow_enumpins.c Loading commit data...
dshow_filter.c Loading commit data...
dshow_pin.c Loading commit data...
fbdev_common.c Loading commit data...
fbdev_common.h Loading commit data...
fbdev_dec.c Loading commit data...
fbdev_enc.c Loading commit data...
file_open.c Loading commit data...
gdigrab.c Loading commit data...
iec61883.c Loading commit data...
internal.h Loading commit data...
jack.c Loading commit data...
kmsgrab.c Loading commit data...
lavfi.c Loading commit data...
libavdevice.v Loading commit data...
libcdio.c Loading commit data...
libdc1394.c Loading commit data...
openal-dec.c Loading commit data...
opengl_enc.c Loading commit data...
opengl_enc_shaders.h Loading commit data...
oss.c Loading commit data...
oss.h Loading commit data...
oss_dec.c Loading commit data...
oss_enc.c Loading commit data...
pulse_audio_common.c Loading commit data...
pulse_audio_common.h Loading commit data...
pulse_audio_dec.c Loading commit data...
pulse_audio_enc.c Loading commit data...
reverse.c Loading commit data...
sdl2.c Loading commit data...
sndio.c Loading commit data...
sndio.h Loading commit data...
sndio_dec.c Loading commit data...
sndio_enc.c Loading commit data...
timefilter.c Loading commit data...
timefilter.h Loading commit data...
utils.c Loading commit data...
v4l2-common.c Loading commit data...
v4l2-common.h Loading commit data...
v4l2.c Loading commit data...
v4l2enc.c Loading commit data...
version.h Loading commit data...
vfwcap.c Loading commit data...
xcbgrab.c Loading commit data...
xv.c Loading commit data...