[asterisk-commits] mjordan: trunk r410275 - in /trunk: ./ res/ari/resource_channels.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Mar 8 09:46:03 CST 2014


Author: mjordan
Date: Sat Mar  8 09:45:59 2014
New Revision: 410275

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=410275
Log:
resource_channels: Check if a passed in ID is NULL before checking its length

Calling strlen on a NULL string is explosive. This patch checks whether or not
the passed in string is NULL or zero length before checking to see if the
string is too long.
........

Merged revisions 410274 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/res/ari/resource_channels.c

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

Modified: trunk/res/ari/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_channels.c?view=diff&rev=410275&r1=410274&r2=410275
==============================================================================
--- trunk/res/ari/resource_channels.c (original)
+++ trunk/res/ari/resource_channels.c Sat Mar  8 09:45:59 2014
@@ -778,8 +778,8 @@
 	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
 	struct ast_assigned_ids assignedids = {args_channel_id, args_other_channel_id};
 
-	if (strlen(assignedids.uniqueid) >= AST_MAX_UNIQUEID || 
-		strlen(assignedids.uniqueid2) >= AST_MAX_UNIQUEID) {
+	if ((!ast_strlen_zero(assignedids.uniqueid) && strlen(assignedids.uniqueid) >= AST_MAX_UNIQUEID) || 
+		(!ast_strlen_zero(assignedids.uniqueid) && strlen(assignedids.uniqueid2) >= AST_MAX_UNIQUEID)) {
 		ast_log(LOG_WARNING, "Uniqueid length exceeds maximum of %d\n", AST_MAX_UNIQUEID);
 	}
 




More information about the asterisk-commits mailing list