aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-11-24 11:56:10 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2017-12-01 13:36:30 +0100
commit06c3f8d3cb0c0ab933b0c246c6c6e6ef5afd42c1 (patch)
treefd0420a6bca7dac3cbec56b5a7e385cdf89f2f1b /src/osmo-bsc
parent3ada5397d7b38c3fcda943a121496fd1c1197e52 (diff)
mgcp: do not fail silently on snprintf()
The snprintf() that is used to compose the fsm name on an assignment request may cause a silent failure. The buffer is large enough to take the string under all circumstances. If snprintf() fails, this would mean we have some other serious problem. use OSMO_ASSERT in case the snprintf() fails, so the failure gets noticed. Change-Id: I3c36df8cfd0880c524244048a993cd136be41f56
Diffstat (limited to 'src/osmo-bsc')
-rw-r--r--src/osmo-bsc/osmo_bsc_mgcp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/osmo-bsc/osmo_bsc_mgcp.c b/src/osmo-bsc/osmo_bsc_mgcp.c
index be6c7ded9..81a4093d1 100644
--- a/src/osmo-bsc/osmo_bsc_mgcp.c
+++ b/src/osmo-bsc/osmo_bsc_mgcp.c
@@ -1015,8 +1015,7 @@ struct mgcp_ctx *mgcp_assignm_req(void *ctx, struct mgcp_client *mgcp, struct os
OSMO_ASSERT(mgcp);
OSMO_ASSERT(conn);
- if(snprintf(name, sizeof(name), "MGW_%i", conn->conn_id) >= sizeof(name))
- return NULL;
+ OSMO_ASSERT(snprintf(name, sizeof(name), "MGW_%i", conn->conn_id) < sizeof(name));
/* Register the fsm description (if not already done) */
if (fsm_registered == false) {