diff options
Diffstat (limited to 'funcs')
-rw-r--r-- | funcs/func_callerid.c | 7 | ||||
-rw-r--r-- | funcs/func_cdr.c | 6 | ||||
-rw-r--r-- | funcs/func_groupcount.c | 3 | ||||
-rw-r--r-- | funcs/func_language.c | 4 | ||||
-rw-r--r-- | funcs/func_moh.c | 5 | ||||
-rw-r--r-- | funcs/func_timeout.c | 6 |
6 files changed, 22 insertions, 9 deletions
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c index 264c404dd..374d13133 100644 --- a/funcs/func_callerid.c +++ b/funcs/func_callerid.c @@ -42,6 +42,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *callerid_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) { + if (!chan) + return ""; + if (!strncasecmp("all", data, 3)) { snprintf(buf, len, "\"%s\" <%s>", chan->cid.cid_name ? chan->cid.cid_name : "", chan->cid.cid_num ? chan->cid.cid_num : ""); } else if (!strncasecmp("name", data, 4)) { @@ -73,9 +76,9 @@ static char *callerid_read(struct ast_channel *chan, char *cmd, char *data, char static void callerid_write(struct ast_channel *chan, char *cmd, char *data, const char *value) { - if (!value) + if (!value || !chan) return; - + if (!strncasecmp("all", data, 3)) { char name[256]; char num[256]; diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c index fdd241894..5ff3ffcf9 100644 --- a/funcs/func_cdr.c +++ b/funcs/func_cdr.c @@ -44,7 +44,7 @@ static char *builtin_function_cdr_read(struct ast_channel *chan, char *cmd, char int argc; char *argv[2]; int recursive = 0; - struct ast_cdr *cdr = chan->cdr; + struct ast_cdr *cdr = chan ? chan->cdr : NULL; if (ast_strlen_zero(data)) return NULL; @@ -78,9 +78,9 @@ static void builtin_function_cdr_write(struct ast_channel *chan, char *cmd, char char *argv[2]; int recursive = 0; - if (ast_strlen_zero(data) || !value) + if (ast_strlen_zero(data) || !value || !chan) return; - + mydata = ast_strdupa(data); argc = ast_app_separate_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0])); diff --git a/funcs/func_groupcount.c b/funcs/func_groupcount.c index 0f07d8327..87bcdf4f5 100644 --- a/funcs/func_groupcount.c +++ b/funcs/func_groupcount.c @@ -149,6 +149,9 @@ static char *group_list_function_read(struct ast_channel *chan, char *cmd, char char tmp1[1024] = ""; char tmp2[1024] = ""; + if (!chan) + return ""; + headp=&chan->varshead; AST_LIST_TRAVERSE(headp,current,entries) { if (!strncmp(ast_var_name(current), GROUP_CATEGORY_PREFIX "_", strlen(GROUP_CATEGORY_PREFIX) + 1)) { diff --git a/funcs/func_language.c b/funcs/func_language.c index ea829a2f4..eef732326 100644 --- a/funcs/func_language.c +++ b/funcs/func_language.c @@ -36,14 +36,14 @@ static char *builtin_function_language_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) { - ast_copy_string(buf, chan->language, len); + ast_copy_string(buf, chan ? chan->language : "", len); return buf; } static void builtin_function_language_write(struct ast_channel *chan, char *cmd, char *data, const char *value) { - if (value) + if (chan && value) ast_copy_string(chan->language, value, sizeof(chan->language)); } diff --git a/funcs/func_moh.c b/funcs/func_moh.c index 25aa73af7..203a4332d 100644 --- a/funcs/func_moh.c +++ b/funcs/func_moh.c @@ -32,14 +32,15 @@ static char *function_moh_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) { - ast_copy_string(buf, chan->musicclass, len); + ast_copy_string(buf, chan ? chan->musicclass : "", len); return buf; } static void function_moh_write(struct ast_channel *chan, char *cmd, char *data, const char *value) { - ast_copy_string(chan->musicclass, value, sizeof(chan->musicclass)); + if (chan) + ast_copy_string(chan->musicclass, value, sizeof(chan->musicclass)); } #ifndef BUILTIN_FUNC diff --git a/funcs/func_timeout.c b/funcs/func_timeout.c index 5983617aa..95490594e 100644 --- a/funcs/func_timeout.c +++ b/funcs/func_timeout.c @@ -42,6 +42,9 @@ static char *builtin_function_timeout_read(struct ast_channel *chan, char *cmd, { time_t myt; + if (!chan) + return ""; + if (!data) { ast_log(LOG_ERROR, "Must specify type of timeout to get.\n"); return NULL; @@ -86,6 +89,9 @@ static void builtin_function_timeout_write(struct ast_channel *chan, char *cmd, char timestr[64]; struct tm myt; + if (!chan) + return; + if (!data) { ast_log(LOG_ERROR, "Must specify type of timeout to set.\n"); return; |