]> Repos - portaudio/commit
alsa: Increase snprintf buffer size to fix warning (#566)
authorMonkeybreadSoftware <support@monkeybreadsoftware.de>
Thu, 13 May 2021 00:36:10 +0000 (02:36 +0200)
committerGitHub <noreply@github.com>
Thu, 13 May 2021 00:36:10 +0000 (10:36 +1000)
commit840489460fe77d5bce1fa8b13865ccea27f54ba1
tree3df1d036e9ba7665275a869e7759bad60cd93e7f
parentfebd58ebba3200723fdc1ef6067dedcc01a90efb
alsa: Increase snprintf buffer size to fix warning (#566)

Avoid compiler warning suggesting the buffer is too small:

../PortAudioLib/portaudio/src/hostapi/alsa/pa_linux_alsa.c: In function 'BuildDeviceList.constprop':
../PortAudioLib/portaudio/src/hostapi/alsa/pa_linux_alsa.c:1304:45: warning: '%s' directive output may be truncated writing up to 49 bytes into a region of size between 46 and 50 [-Wformat-truncation=]
             snprintf( buf, sizeof (buf), "%s%s,%d", hwPrefix, alsaCardName, devIdx );
                                             ^~                ~~~~~~~~~~~~
../PortAudioLib/portaudio/src/hostapi/alsa/pa_linux_alsa.c:1304:42: note: directive argument in the range [0, 2147483647]
             snprintf( buf, sizeof (buf), "%s%s,%d", hwPrefix, alsaCardName, devIdx );
                                          ^~~~~~~~~
../PortAudioLib/portaudio/src/hostapi/alsa/pa_linux_alsa.c:1304:13: note: 'snprintf' output between 3 and 65 bytes into a destination of size 50
             snprintf( buf, sizeof (buf), "%s%s,%d", hwPrefix, alsaCardName, devIdx );
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/hostapi/alsa/pa_linux_alsa.c