aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-01 15:58:40 +0000
committerseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-01 15:58:40 +0000
commitcb8c61a3c20872fa4770b3bd8e6c945fd7e5c725 (patch)
tree3f4e5d59051b6388096c80387a89d963ab901355 /apps
parentd628bd5b99dcd93f4cd2e442e875a6e479365f3c (diff)
Fix a crash in app_queue with very long member lists.
A user reported via #asterisk that with very long lists of members, a crash occurs in ast_strdupa, so just use a single buffer and ast_copy_string instead of stack allocating copys of each interface name. (Related to revision 191041 in branches/1.4) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@191424 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 8c2d453cc..7af50dd46 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -696,15 +696,15 @@ static int update_status(const char *interface, const int status)
struct member *cur;
struct ao2_iterator mem_iter, queue_iter;
struct call_queue *q;
+ char tmp_interface[80];
queue_iter = ao2_iterator_init(queues, 0);
while ((q = ao2_iterator_next(&queue_iter))) {
ao2_lock(q);
mem_iter = ao2_iterator_init(q->members, 0);
while ((cur = ao2_iterator_next(&mem_iter))) {
- char *tmp_interface;
char *slash_pos;
- tmp_interface = ast_strdupa(cur->state_interface);
+ ast_copy_string(tmp_interface, cur->state_interface, sizeof(tmp_interface));
if ((slash_pos = strchr(tmp_interface, '/')))
if (!strncasecmp(tmp_interface, "Local", 5) && (slash_pos = strchr(slash_pos + 1, '/')))
*slash_pos = '\0';
@@ -747,12 +747,12 @@ static int update_status(const char *interface, const int status)
static void *handle_statechange(struct statechange *sc)
{
struct member_interface *curint;
+ char interface[80];
AST_LIST_LOCK(&interfaces);
AST_LIST_TRAVERSE(&interfaces, curint, list) {
- char *interface;
char *slash_pos;
- interface = ast_strdupa(curint->interface);
+ ast_copy_string(interface, curint->interface, sizeof(interface));
if ((slash_pos = strchr(interface, '/')))
if ((slash_pos = strchr(slash_pos + 1, '/')))
*slash_pos = '\0';