mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-20 16:50:14 +00:00
Fixes segfault when using ParkAndAnnounce. Also, loop made more efficient as announce template only needs to be checked until the number of colon separated arguments run out, not the entire pointer storage array. Was done in a similiar fashion in 1.4, but here we're using less variables.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121131 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -144,9 +144,12 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
ast_verb(4, "Announce Template:%s\n", args.template);
|
||||
|
||||
for (looptemp = 0, tmp[looptemp++] = strsep(&args.template, ":");
|
||||
looptemp < sizeof(tmp) / sizeof(tmp[0]);
|
||||
tmp[looptemp++] = strsep(&args.template, ":"));
|
||||
for (looptemp = 0; looptemp < sizeof(tmp) / sizeof(tmp[0]); looptemp++) {
|
||||
if ((tmp[looptemp] = strsep(&args.template, ":")) != NULL)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < looptemp; i++) {
|
||||
ast_verb(4, "Announce:%s\n", tmp[i]);
|
||||
|
||||
Reference in New Issue
Block a user