mirror of
https://github.com/asterisk/asterisk.git
synced 2026-06-09 11:55:19 +00:00
Use a safe list traversal while checking for duplicate vars in pbx_builtin_setvar_helper.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@243486 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -5937,14 +5937,15 @@ void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const
|
||||
nametail++;
|
||||
}
|
||||
|
||||
AST_LIST_TRAVERSE (headp, newvariable, entries) {
|
||||
AST_LIST_TRAVERSE_SAFE_BEGIN(headp, newvariable, entries) {
|
||||
if (strcasecmp(ast_var_name(newvariable), nametail) == 0) {
|
||||
/* there is already such a variable, delete it */
|
||||
AST_LIST_REMOVE(headp, newvariable, entries);
|
||||
AST_LIST_REMOVE_CURRENT(headp, entries);
|
||||
ast_var_delete(newvariable);
|
||||
break;
|
||||
}
|
||||
}
|
||||
AST_LIST_TRAVERSE_SAFE_END;
|
||||
|
||||
if (value) {
|
||||
if ((option_verbose > 1) && (headp == &globals))
|
||||
|
||||
Reference in New Issue
Block a user