]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
error checking on dial string.
authorMichael Jerris <mike@jerris.com>
Mon, 7 Jan 2008 16:50:20 +0000 (16:50 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 7 Jan 2008 16:50:20 +0000 (16:50 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@359 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/mod_openzap/mod_openzap.c

index 243135959ae072ff8aa7d05c1c88619b2195a8c5..b997997dd6e972bc0d7bde6976bcd66a74936e35 100644 (file)
@@ -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;