aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_callerid.c6
-rw-r--r--funcs/func_cdr.c4
-rw-r--r--funcs/func_groupcount.c3
-rw-r--r--funcs/func_language.c4
-rw-r--r--funcs/func_moh.c5
-rw-r--r--funcs/func_timeout.c6
6 files changed, 20 insertions, 8 deletions
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c
index 6068739d4..be3026325 100644
--- a/funcs/func_callerid.c
+++ b/funcs/func_callerid.c
@@ -43,7 +43,9 @@ static int callerid_read(struct ast_channel *chan, char *cmd, char *data,
{
char *opt = data;
- /* XXX we are not always clearing the buffer. Is this correct ? */
+ if (!chan)
+ return -1;
+
if (strchr(opt, '|')) {
char name[80], num[80];
@@ -98,7 +100,7 @@ static int callerid_read(struct ast_channel *chan, char *cmd, char *data,
static int callerid_write(struct ast_channel *chan, char *cmd, char *data,
const char *value)
{
- if (!value)
+ if (!value || !chan)
return -1;
if (!strncasecmp("all", data, 3)) {
diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c
index daed3c9b8..74d9eec86 100644
--- a/funcs/func_cdr.c
+++ b/funcs/func_cdr.c
@@ -57,7 +57,7 @@ static int cdr_read(struct ast_channel *chan, char *cmd, char *parse,
{
char *ret;
struct ast_flags flags = { 0 };
- struct ast_cdr *cdr = chan->cdr;
+ struct ast_cdr *cdr = chan ? chan->cdr : NULL;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(variable);
AST_APP_ARG(options);
@@ -94,7 +94,7 @@ static int cdr_write(struct ast_channel *chan, char *cmd, char *parse,
AST_APP_ARG(options);
);
- if (ast_strlen_zero(parse) || !value)
+ if (ast_strlen_zero(parse) || !value || !chan)
return -1;
AST_STANDARD_APP_ARGS(args, parse);
diff --git a/funcs/func_groupcount.c b/funcs/func_groupcount.c
index ed96e34b0..d804e0c1d 100644
--- a/funcs/func_groupcount.c
+++ b/funcs/func_groupcount.c
@@ -157,6 +157,9 @@ static int group_list_function_read(struct ast_channel *chan, char *cmd,
char tmp1[1024] = "";
char tmp2[1024] = "";
+ if (!chan)
+ return -1;
+
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 af6f9d0a9..43b368f4f 100644
--- a/funcs/func_language.c
+++ b/funcs/func_language.c
@@ -48,7 +48,7 @@ static int language_read(struct ast_channel *chan, char *cmd, char *data,
"LANGUAGE() is deprecated; use CHANNEL(language) instead.\n");
}
- ast_copy_string(buf, chan->language, len);
+ ast_copy_string(buf, chan ? chan->language : "", len);
return 0;
}
@@ -62,7 +62,7 @@ static int language_write(struct ast_channel *chan, char *cmd, char *data,
"LANGUAGE() is deprecated; use CHANNEL(language) instead.\n");
}
- if (value)
+ if (chan && value)
ast_string_field_set(chan, language, value);
return 0;
diff --git a/funcs/func_moh.c b/funcs/func_moh.c
index c8e29a747..86701b161 100644
--- a/funcs/func_moh.c
+++ b/funcs/func_moh.c
@@ -46,7 +46,7 @@ static int moh_read(struct ast_channel *chan, char *cmd, char *data,
ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
}
- ast_copy_string(buf, chan->musicclass, len);
+ ast_copy_string(buf, chan ? chan->musicclass : "", len);
return 0;
}
@@ -59,7 +59,8 @@ static int moh_write(struct ast_channel *chan, char *cmd, char *data,
ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
}
- ast_string_field_set(chan, musicclass, value);
+ if (chan)
+ ast_string_field_set(chan, musicclass, value);
return 0;
}
diff --git a/funcs/func_timeout.c b/funcs/func_timeout.c
index b88ae078f..7d9d535ea 100644
--- a/funcs/func_timeout.c
+++ b/funcs/func_timeout.c
@@ -45,6 +45,9 @@ static int timeout_read(struct ast_channel *chan, char *cmd, char *data,
{
time_t myt;
+ if (!chan)
+ return -1;
+
if (!data) {
ast_log(LOG_ERROR, "Must specify type of timeout to get.\n");
return -1;
@@ -90,6 +93,9 @@ static int timeout_write(struct ast_channel *chan, char *cmd, char *data,
char timestr[64];
struct tm myt;
+ if (!chan)
+ return -1;
+
if (!data) {
ast_log(LOG_ERROR, "Must specify type of timeout to set.\n");
return -1;