[asterisk-bugs] [JIRA] (ASTERISK-23254) Bad ao2_find() usage in pjsip_options.c

Richard Mudgett (JIRA) noreply at issues.asterisk.org
Tue Feb 4 18:57:03 CST 2014


Richard Mudgett created ASTERISK-23254:
------------------------------------------

             Summary: Bad ao2_find() usage in pjsip_options.c
                 Key: ASTERISK-23254
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23254
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Resources/res_pjsip
    Affects Versions: 12.0.0
            Reporter: Richard Mudgett


In the res/res_pjsip/pjsip_options.c:on_endpoint() function the ao2_find is useless because it will never match anything.
{code}
if (ao2_find(contacts, arg, OBJ_NODATA | OBJ_POINTER)) {
	return CMP_MATCH;
}
{code}

As a result pjsip_options.c:find_endpoints() will never return any matching endpoints and the pjsip_options.c:qualify_contact() will not have an endpoint to qualify.

pjsip_options.c:qualify_contact() needs to check if it actually finds an endpoint before sending the qualify.  If it cannot find an endpoint it needs to generate an ERROR message and return.  A crash is likely if an endpoint is not found and the qualify message is challenged for authentication.  Alternatively, a configured default endpoint could be used as a final fallback before failing.

{code}
if (!endpoint_local) {
	struct ao2_iterator *endpoint_iterator = find_endpoints(contact);

	/* try to find endpoints that are associated with the contact */
	if (endpoint_iterator) {
		/* find "first" endpoint in order to authenticate - actually any
		   endpoint should do that matched on the contact */
		endpoint_local = ao2_iterator_next(endpoint_iterator);
		ao2_iterator_destroy(endpoint_iterator);
	}
}
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list