fix rsl_chan_nr_str_{buf,c}(): enlarge the buffer size

20 bytes is not enough for some VAMOS specific channel number values,
so the resulting string representation gets truncated by snprintf():

  expected: "VAMOS TCH/H(0) on TS4\0"
  actual:   "VAMOS TCH/H(0) on T\0"

Let's enlarge the buffers to 32 bytes.

Change-Id: I68d839f4ab742cf56de34e7e22572a1163aec2da
This commit is contained in:
Vadim Yanitskiy 2021-09-30 22:54:07 +06:00
parent 137efc9b18
commit 6b60d52abf
1 changed files with 3 additions and 3 deletions

View File

@ -268,7 +268,7 @@ char *rsl_chan_nr_str_buf(char *buf, size_t buf_len, uint8_t chan_nr)
*/
const char *rsl_chan_nr_str(uint8_t chan_nr)
{
static __thread char str[20];
static __thread char str[32];
return rsl_chan_nr_str_buf(str, sizeof(str), chan_nr);
}
@ -279,10 +279,10 @@ const char *rsl_chan_nr_str(uint8_t chan_nr)
*/
char *rsl_chan_nr_str_c(const void *ctx, uint8_t chan_nr)
{
char *str = talloc_size(ctx, 20);
char *str = talloc_size(ctx, 32);
if (!str)
return NULL;
return rsl_chan_nr_str_buf(str, 20, chan_nr);
return rsl_chan_nr_str_buf(str, 32, chan_nr);
}
static const struct value_string rsl_err_vals[] = {