From f926e83c027bd385d81238fe48d0b839862f0d72 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 7 Jan 2008 16:50:20 +0000 Subject: [PATCH] error checking on dial string. git-svn-id: http://svn.openzap.org/svn/openzap/trunk@359 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/openzap/mod_openzap/mod_openzap.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libs/openzap/mod_openzap/mod_openzap.c b/libs/openzap/mod_openzap/mod_openzap.c index 243135959a..b997997dd6 100644 --- a/libs/openzap/mod_openzap/mod_openzap.c +++ b/libs/openzap/mod_openzap/mod_openzap.c @@ -717,18 +717,25 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } + if (switch_strlen_zero(outbound_profile->destination_number)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid dial string\n"); + return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; + } + dest = outbound_profile->destination_number; if ((p = strchr(outbound_profile->destination_number, '/'))) { dest = p + 1; span_id = atoi(outbound_profile->destination_number); - chan_id = atoi(dest); - if ((p = strchr(dest, '/'))) { - dest = p + 1; + if (!switch_strlen_zero(dest)) { + chan_id = atoi(dest); + if ((p = strchr(dest, '/'))) { + dest = p + 1; + } } } - if (!dest) { + if (!switch_strlen_zero(dest)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid dial string\n"); return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } @@ -753,8 +760,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } - - if ((*new_session = switch_core_session_request(openzap_endpoint_interface, pool)) != 0) { private_t *tech_pvt; switch_channel_t *channel;