aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_morsecode.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-30 19:21:04 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-30 19:21:04 +0000
commit712c72b0df2fb7badefffb68c319f4a105ae9c71 (patch)
tree89d592fc9e276ed41a21062589ea44fedcf6d0d2 /apps/app_morsecode.c
parent829d44846c2cbb8f568e5368c8e033daba211ae0 (diff)
Lock around variables retrieved, and copy the values, if they stay persistent,
since another thread could remove them. (closes issue #12541) Reported by: snuffy Patches: bug_12156_apps.diff uploaded by snuffy (license 35) Several additional changes by me git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114904 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_morsecode.c')
-rw-r--r--apps/app_morsecode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/app_morsecode.c b/apps/app_morsecode.c
index 6c88ed32c..455ee04c1 100644
--- a/apps/app_morsecode.c
+++ b/apps/app_morsecode.c
@@ -111,16 +111,20 @@ static int morsecode_exec(struct ast_channel *chan, void *data)
}
/* Use variable MORESEDITLEN, if set (else 80) */
+ ast_channel_lock(chan);
ditlenc = pbx_builtin_getvar_helper(chan, "MORSEDITLEN");
if (ast_strlen_zero(ditlenc) || (sscanf(ditlenc, "%d", &ditlen) != 1)) {
ditlen = 80;
}
+ ast_channel_unlock(chan);
/* Use variable MORSETONE, if set (else 800) */
+ ast_channel_lock(chan);
tonec = pbx_builtin_getvar_helper(chan, "MORSETONE");
if (ast_strlen_zero(tonec) || (sscanf(tonec, "%d", &tone) != 1)) {
tone = 800;
}
+ ast_channel_unlock(chan);
for (digit = data; *digit; digit++) {
int digit2 = *digit;