Change in libosmocore[master]: fix rsl_chan_nr_str_{buf, c}(): enlarge the buffer size

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Fri Oct 1 09:47:13 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/25656 )


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

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
---
M src/gsm/rsl.c
1 file changed, 3 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/56/25656/1

diff --git a/src/gsm/rsl.c b/src/gsm/rsl.c
index 0574966..e648d82 100644
--- a/src/gsm/rsl.c
+++ b/src/gsm/rsl.c
@@ -268,7 +268,7 @@
  */
 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 @@
  */
 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[] = {

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25656
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I68d839f4ab742cf56de34e7e22572a1163aec2da
Gerrit-Change-Number: 25656
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211001/ef5716f6/attachment.htm>


More information about the gerrit-log mailing list