fix segfaults on bad api command usage MODAPP-34

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6010 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-10-20 06:01:41 +00:00
parent 4a1238e30b
commit 3ccda4e25e
1 changed files with 19 additions and 1 deletions

View File

@ -333,6 +333,11 @@ SWITCH_STANDARD_API(tone_detect_session_function)
time_t to = 0;
switch_core_session_t *rsession;
if (!cmd) {
stream->write_function(stream, "USAGE: %s\n", TONE_DETECT_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
mydata = strdup(cmd);
assert(mydata != NULL);
@ -989,6 +994,11 @@ static void sch_api_callback(switch_scheduler_task_t *task)
SWITCH_STANDARD_API(sched_del_function)
{
uint32_t cnt = 0;
if (!cmd) {
stream->write_function(stream, "Invalid syntax\n");
return SWITCH_STATUS_SUCCESS;
}
if (switch_is_digit_string(cmd)) {
int64_t tmp;
@ -1010,6 +1020,11 @@ SWITCH_STANDARD_API(xml_wrap_api_function)
char *dcommand, *edata = NULL, *send = NULL, *command, *arg = NULL;
switch_stream_handle_t mystream = { 0 };
int encoded = 0, elen = 0;
if (!cmd) {
stream->write_function(stream, "Invalid syntax\n");
return SWITCH_STATUS_SUCCESS;
}
if ((dcommand = strdup(cmd))) {
if (!strncasecmp(dcommand, "encoded ", 8)) {
@ -1059,7 +1074,10 @@ SWITCH_STANDARD_API(sched_api_function)
char *tm = NULL, *dcmd, *group;
time_t when;
assert(cmd != NULL);
if (!cmd) {
stream->write_function(stream, "Invalid syntax\n");
return SWITCH_STATUS_SUCCESS;
}
tm = strdup(cmd);
assert(tm != NULL);