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);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Uwe Hermann 2018-07-22 16:59:38 +02:00
parent 0f5bba9622
commit 19d816c54a
1 changed files with 1 additions and 1 deletions

View File

@ -320,7 +320,7 @@ static int receive(struct sr_input *in, GString *buf)
{
struct context *inc;
int ret;
char channelname[8];
char channelname[16];
g_string_append_len(in->buf, buf->str, buf->len);