[asterisk-commits] seanbright: branch 1.4 r191041 - /branches/1.4/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 29 10:23:21 CDT 2009


Author: seanbright
Date: Wed Apr 29 10:23:07 2009
New Revision: 191041

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=191041
Log:
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.

Modified:
    branches/1.4/apps/app_queue.c

Modified: branches/1.4/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/apps/app_queue.c?view=diff&rev=191041&r1=191040&r2=191041
==============================================================================
--- branches/1.4/apps/app_queue.c (original)
+++ branches/1.4/apps/app_queue.c Wed Apr 29 10:23:07 2009
@@ -600,9 +600,9 @@
 		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 @@
 
 	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';




More information about the asterisk-commits mailing list