[asterisk-commits] mjordan: trunk r348215 - in /trunk: ./ apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 14 16:08:56 CST 2011


Author: mjordan
Date: Wed Dec 14 16:08:55 2011
New Revision: 348215

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=348215
Log:
Fixed Asterisk crash when function QUEUE_MEMBER receives invalid input

The function QUEUE_MEMBER has two required parameters (queuename, option).  It
was only checking for the presence of queuename.  The patch checks for the
existence of the option parameter and provides better error logging when
invalid values are provided for the option parameter as well.
........

Merged revisions 348211 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    trunk/   (props changed)
    trunk/apps/app_queue.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=348215&r1=348214&r2=348215
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed Dec 14 16:08:55 2011
@@ -6372,11 +6372,16 @@
 	buf[0] = '\0';
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
+		ast_log(LOG_ERROR, "Missing required argument. %s(<queuename>,<option>[<interface>])\n", cmd);
 		return -1;
 	}
 
 	AST_STANDARD_APP_ARGS(args, data);
+
+	if (args.argc < 2) {
+		ast_log(LOG_ERROR, "Missing required argument. %s(<queuename>,<option>[<interface>])\n", cmd);
+		return -1;
+	}
 
 	if ((q = find_load_queue_rt_friendly(args.queuename))) {
 		ao2_lock(q);
@@ -6427,6 +6432,9 @@
 			   ((m = interface_exists(q, args.interface)))) {
 			count = m->ignorebusy;
 			ao2_ref(m, -1);
+		} else {
+			ast_log(LOG_ERROR, "Unknown option %s provided to %s, valid values are: "
+				"logged, free, ready, count, penalty, paused, ignorebusy\n", args.option, cmd);
 		}
 		ao2_unlock(q);
 		queue_t_unref(q, "Done with temporary reference in QUEUE_MEMBER()");




More information about the asterisk-commits mailing list