diff options
author | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-29 15:23:07 +0000 |
---|---|---|
committer | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-29 15:23:07 +0000 |
commit | d1e23fcb79440227fb95f57458a5a474229a68b8 (patch) | |
tree | c1ec01d7282625a5b6d05f226fe547ec96dd09e7 /apps/app_queue.c | |
parent | 472074170f0d68c5e0b57c730d2ea140292c0572 (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.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@191041 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r-- | apps/app_queue.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index e7d21be7a..1af667097 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -600,9 +600,9 @@ static int update_status(const char *interface, const int status) ast_mutex_lock(&q->lock); mem_iter = ao2_iterator_init(q->members, 0); while ((cur = ao2_iterator_next(&mem_iter))) { - char *tmp_interface; + char tmp_interface[80]; 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 ((slash_pos = strchr(slash_pos + 1, '/'))) *slash_pos = '\0'; @@ -658,9 +658,9 @@ static void *handle_statechange(struct statechange *sc) AST_LIST_LOCK(&interfaces); AST_LIST_TRAVERSE(&interfaces, curint, list) { - char *interface; + char interface[80]; 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'; |