]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
avoiding segfault i should never be called
authorAnthony Minessale <anthony.minessale@gmail.com>
Sun, 3 Sep 2006 04:29:42 +0000 (04:29 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sun, 3 Sep 2006 04:29:42 +0000 (04:29 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2485 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_exosip/mod_exosip.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c

index eb721660d90824ea7ea07817083584fce3389bbf..cc4701feea8bde45bccb5367db1b8e1324bd2289 100644 (file)
@@ -1078,10 +1078,18 @@ static char *find_reg_url(switch_core_db_t *db, char *key, char *val, switch_siz
 static switch_status_t exosip_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
                                                                                         switch_core_session_t **new_session, switch_memory_pool_t *pool)
 {
+
+       if (!outbound_profile->destination_number) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid Destination!\n");
+               return SWITCH_STATUS_GENERR;
+       }
+
+
        if ((*new_session = switch_core_session_request(&exosip_endpoint_interface, pool)) != 0) {
                struct private_object *tech_pvt;
                switch_channel_t *channel;
 
+
                switch_core_session_add_stream(*new_session, NULL);
                if ((tech_pvt =
                         (struct private_object *) switch_core_session_alloc(*new_session, sizeof(struct private_object))) != 0) {
index 124f391f53b171e8f00c9f3d2b764a3e766b8438..3618319c1eb7a2e34accdc1ec200da75d18416b3 100644 (file)
@@ -1415,6 +1415,11 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
 
                dest = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
 
+               if (!strchr(dest, '/')) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Channel String\n");
+                       return JS_TRUE;
+               }
+
                if (argc > 2) {
                        dialplan = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
                }