From e1d499827d42230ce9d33f5df1ddfd9f947c1bbe Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 3 Sep 2006 04:29:42 +0000 Subject: [PATCH] avoiding segfault i should never be called git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2485 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_exosip/mod_exosip.c | 8 ++++++++ src/mod/languages/mod_spidermonkey/mod_spidermonkey.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/mod/endpoints/mod_exosip/mod_exosip.c b/src/mod/endpoints/mod_exosip/mod_exosip.c index eb721660d9..cc4701feea 100644 --- a/src/mod/endpoints/mod_exosip/mod_exosip.c +++ b/src/mod/endpoints/mod_exosip/mod_exosip.c @@ -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) { diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 124f391f53..3618319c1e 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -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])); }