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: https://origsvn.digium.com/svn/asterisk/trunk@114904 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2008-04-30 19:21:04 +00:00
parent 4c3aecfc55
commit 527c601d0c
10 changed files with 142 additions and 64 deletions

View File

@@ -351,8 +351,11 @@ static int local_read(struct ast_channel *chan, const char *cmd, char *data, cha
frame = AST_LIST_FIRST(oldlist);
AST_LIST_TRAVERSE(&frame->varshead, variables, entries) {
if (!strcmp(data, ast_var_name(variables))) {
const char *tmp = pbx_builtin_getvar_helper(chan, data);
const char *tmp;
ast_channel_lock(chan);
tmp = pbx_builtin_getvar_helper(chan, data);
ast_copy_string(buf, S_OR(tmp, ""), len);
ast_channel_unlock(chan);
break;
}
}