]> sigrok.org Git - libsigrok.git/commit
input/wav: Fix potential buffer overflow (and compiler warning).
authorUwe Hermann <redacted>
Sun, 22 Jul 2018 14:59:38 +0000 (16:59 +0200)
committerUwe Hermann <redacted>
Sun, 22 Jul 2018 14:59:38 +0000 (16:59 +0200)
commit19d816c54ad24d93b2af6ba2f0406d6f8df0a3af
tree7f8a4ab4155dc0c87f650a42656323203cb94ef1
parent0f5bba9622cc4d1ac934d1534fe2196f9b203ad6
input/wav: Fix potential buffer overflow (and compiler warning).

With gcc 8 this yielded:

  src/input/wav.c: In function ‘receive’:
  src/input/wav.c:345:51: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
       snprintf(channelname, sizeof(channelname), "CH%d", i + 1);
                                                     ^~
  src/input/wav.c:345:48: note: directive argument in the range [1, 2147483647]
       snprintf(channelname, sizeof(channelname), "CH%d", i + 1);
                                                  ^~~~~~
  src/input/wav.c:345:5: note: ‘snprintf’ output between 4 and 13 bytes into a destination of size 8
       snprintf(channelname, sizeof(channelname), "CH%d", i + 1);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/input/wav.c