aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-10-08 16:58:13 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-10-08 16:58:13 +0200
commit864db676cd56213dd59594eae62a576acf55ee62 (patch)
treea00c26425b7d9598339f6d7d7d3906c943f42404 /openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
parentf55bb41c326b3d9582912818d38b7b492d63a4ce (diff)
osmux: Make sure that bigger Osmux ids actually fitzecke/features/osmux-reliability
We put a signed integer into this string but did not account for the newline and for the terminating NUL of the string. Add the newline to the string and add one for NUL. Spotted while accidently having a CID of 255.
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
index 0105c7e3d..9fd99677a 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
@@ -818,7 +818,7 @@ static void patch_mgcp(struct msgb *output, const char *op, const char *tok,
int slen;
int ret;
char buf[40];
- char osmux_extension[strlen("X-Osmux: 255")];
+ char osmux_extension[strlen("\nX-Osmux: 255") + 1];
buf[0] = buf[39] = '\0';
ret = sscanf(tok, "%*s %s", buf);
@@ -829,7 +829,7 @@ static void patch_mgcp(struct msgb *output, const char *op, const char *tok,
}
if (osmux_cid >= 0)
- sprintf(osmux_extension, "\nX-Osmux: %u", osmux_cid);
+ sprintf(osmux_extension, "\nX-Osmux: %u", osmux_cid & 0xff);
else
osmux_extension[0] = '\0';