]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
resource_channels: Check if a passed in ID is NULL before checking its length
authorMatthew Jordan <mjordan@digium.com>
Sat, 8 Mar 2014 15:43:30 +0000 (15:43 +0000)
committerMatthew Jordan <mjordan@digium.com>
Sat, 8 Mar 2014 15:43:30 +0000 (15:43 +0000)
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.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@410274 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/ari/resource_channels.c

index 2d074a16a7a57795ed62b2cb4423485dc5ed7b4e..37595006ddedc520f3b39657ac996ccc4b846eed 100644 (file)
@@ -778,8 +778,8 @@ static void ari_channels_handle_originate_with_id(const char *args_endpoint,
        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);
        }