../src/input/raw_analog.c: In function ‘init’:
../src/input/raw_analog.c:133:31: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
snprintf(channelname, 8, "CH%d", i + 1);
^~
../src/input/raw_analog.c:133:28: note: directive argument in the range [1,
2147483647]
snprintf(channelname, 8, "CH%d", i + 1);
^~~~~~
../src/input/raw_analog.c:133:3: note: ‘snprintf’ output between 4 and 13 bytes into a destination of size 8
snprintf(channelname, 8, "CH%d", i + 1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
struct context *inc;
int num_channels;
- char channelname[8];
+ char channelname[16];
const char *format;
int fmt_index;
in->priv = inc = g_malloc0(sizeof(struct context));
for (int i = 0; i < num_channels; i++) {
- snprintf(channelname, 8, "CH%d", i + 1);
+ snprintf(channelname, sizeof(channelname) - 1, "CH%d", i + 1);
sr_channel_new(in->sdi, i, SR_CHANNEL_ANALOG, TRUE, channelname);
}