aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-07 11:38:00 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-07 11:38:00 +0100
commitea853044c8a5b5c937152feb82aa49ee9c7eff81 (patch)
tree4ba94b99c75abbb176955f583043845bb1f73c39
parent7e0936ee52a9fb35e8921b49f0df0ca04aa60d00 (diff)
mgcp: Merge from master. Fix some issues with the new code
-rw-r--r--src/mgcp/mgcp_protocol.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mgcp/mgcp_protocol.c b/src/mgcp/mgcp_protocol.c
index 9d9bf15..111eedc 100644
--- a/src/mgcp/mgcp_protocol.c
+++ b/src/mgcp/mgcp_protocol.c
@@ -272,14 +272,14 @@ static struct mgcp_endpoint *find_e1_endpoint(struct mgcp_config *cfg,
int trunk, endp, mgcp_endp;
trunk = strtoul(mgcp + 6, &rest, 10);
- if (rest == NULL || rest[0] != '/') {
+ if (rest == NULL || rest[0] != '/' || trunk < 1) {
LOGP(DMGCP, LOGL_ERROR, "Wrong trunk name '%s'\n", mgcp);
return NULL;
}
endp = strtoul(rest + 1, &rest, 10);
if (rest == NULL || rest[0] != '@') {
- LOGP(DMGCP, LOGL_ERROR, "Wrong trunk name '%s'\n", mgcp);
+ LOGP(DMGCP, LOGL_ERROR, "Wrong endpoint name '%s'\n", mgcp);
return NULL;
}
@@ -287,9 +287,10 @@ static struct mgcp_endpoint *find_e1_endpoint(struct mgcp_config *cfg,
if (endp == 1)
return NULL;
- mgcp_endp = mgcp_timeslot_to_endpoint(trunk, endp);
+ mgcp_endp = mgcp_timeslot_to_endpoint(trunk - 1, endp);
if (mgcp_endp < 1 || mgcp_endp >= cfg->number_endpoints) {
LOGP(DMGCP, LOGL_ERROR, "Failed to find endpoint '%s'\n", mgcp);
+ return NULL;
}
return &cfg->endpoints[mgcp_endp];