aboutsummaryrefslogtreecommitdiffstats
path: root/funcs/func_moh.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-19 02:30:18 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-19 02:30:18 +0000
commit1ce325d67c86bf63786232d01a272436f0a38cd2 (patch)
treeb5d65fded5a96a7ee2dddaae0f9153ad01fa2d24 /funcs/func_moh.c
parent5ae8e3ac4214197fec6ef999a6c50123be671979 (diff)
Bug 9557 - Specifying the GetVar AMI action without a Channel parameter can
cause Asterisk to crash. The reason this needs to be fixed in the functions instead of in AMI is because Channel can legitimately be NULL, such as when retrieving global variables. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@61680 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_moh.c')
-rw-r--r--funcs/func_moh.c5
1 files changed, 3 insertions, 2 deletions
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