chan_dahdi.c: Resolve a format-truncation build warning.
With gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0: > chan_dahdi.c:4129:18: error: ‘%s’ directive output may be truncated > writing up to 255 bytes into a region of size between 242 and 252 > [-Werror=format-truncation=] This removes the error-prone sizeof(...) calculations in favor of just doubling the size of the base buffer. Change-Id: I2d276785286730d3d5d0a921bcea2e065dbf27c5
This commit is contained in:
parent
12c4c1bf5f
commit
583e017f34
|
@ -4115,7 +4115,7 @@ static void dahdi_r2_on_context_log(openr2_context_t *r2context, openr2_log_leve
|
|||
{
|
||||
#define CONTEXT_TAG "Context - "
|
||||
char logmsg[256];
|
||||
char completemsg[sizeof(logmsg) + sizeof(CONTEXT_TAG) - 1];
|
||||
char completemsg[sizeof(logmsg) * 2];
|
||||
vsnprintf(logmsg, sizeof(logmsg), fmt, ap);
|
||||
snprintf(completemsg, sizeof(completemsg), CONTEXT_TAG "%s", logmsg);
|
||||
dahdi_r2_write_log(level, completemsg);
|
||||
|
@ -4128,10 +4128,11 @@ static void dahdi_r2_on_chan_log(openr2_chan_t *r2chan, openr2_log_level_t level
|
|||
{
|
||||
#define CHAN_TAG "Chan "
|
||||
char logmsg[256];
|
||||
char completemsg[sizeof(logmsg) + sizeof(CHAN_TAG) - 1];
|
||||
char completemsg[sizeof(logmsg) * 2];
|
||||
vsnprintf(logmsg, sizeof(logmsg), fmt, ap);
|
||||
snprintf(completemsg, sizeof(completemsg), CHAN_TAG "%d - %s", openr2_chan_get_number(r2chan), logmsg);
|
||||
dahdi_r2_write_log(level, completemsg);
|
||||
#undef CHAN_TAG
|
||||
}
|
||||
|
||||
static int dahdi_r2_on_dnis_digit_received(openr2_chan_t *r2chan, char digit)
|
||||
|
|
Loading…
Reference in New Issue