summaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat
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-12 09:11:25 +0200
commit696212798291688a85afc956b6d80c10c7acb033 (patch)
treeebaa1db540e7e92e9ab9a3a83d0d7cda8173ac4a /openbsc/src/osmo-bsc_nat
parent1afe7c7fe5e79435a1ebe9aff622ca20b901d923 (diff)
osmux: Make sure that bigger Osmux ids actually fit
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')
-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 0105c7e..9fd9967 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';