From: Mark Michelson Date: Wed, 27 Jan 2010 18:06:43 +0000 (+0000) Subject: Use a safe list traversal while checking for duplicate vars in pbx_builtin_setvar_helper. X-Git-Tag: 1.4.30-rc2~5^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3db30de4633f42e048bd1e0615b1f47d83f92e9;p=thirdparty%2Fasterisk.git 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 --- diff --git a/main/pbx.c b/main/pbx.c index 18210c5122..928c7bf90f 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -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))