mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 03:48:02 +00:00
Merge "res_pjsip_messaging: Check URI type before dereferencing" into 13
This commit is contained in:
@@ -127,8 +127,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="from" required="false">
|
<parameter name="from" required="false">
|
||||||
<para>A From URI for the message if needed for the
|
<para>A From URI for the message if needed for the
|
||||||
message technology being used to send this message.</para>
|
message technology being used to send this message. This can be a
|
||||||
<xi:include xpointer="xpointer(/docs/info[@name='MessageFromInfo'])" />
|
SIP(S) URI, such as <literal>Alice <sip:alice@atlanta.com></literal>,
|
||||||
|
a string in the format <literal>alice@atlanta.com</literal>, or simply
|
||||||
|
a username such as <literal>alice</literal>.</para>
|
||||||
</parameter>
|
</parameter>
|
||||||
</syntax>
|
</syntax>
|
||||||
<description>
|
<description>
|
||||||
|
|||||||
@@ -235,7 +235,15 @@ static void update_from(pjsip_tx_data *tdata, char *from)
|
|||||||
parsed_name_addr = (pjsip_name_addr *) pjsip_parse_uri(tdata->pool, from,
|
parsed_name_addr = (pjsip_name_addr *) pjsip_parse_uri(tdata->pool, from,
|
||||||
strlen(from), PJSIP_PARSE_URI_AS_NAMEADDR);
|
strlen(from), PJSIP_PARSE_URI_AS_NAMEADDR);
|
||||||
if (parsed_name_addr) {
|
if (parsed_name_addr) {
|
||||||
pjsip_sip_uri *parsed_uri = pjsip_uri_get_uri(parsed_name_addr->uri);
|
pjsip_sip_uri *parsed_uri;
|
||||||
|
|
||||||
|
if (!PJSIP_URI_SCHEME_IS_SIP(parsed_name_addr->uri)
|
||||||
|
&& !PJSIP_URI_SCHEME_IS_SIPS(parsed_name_addr->uri)) {
|
||||||
|
ast_log(LOG_WARNING, "From address '%s' is not a valid SIP/SIPS URI\n", from);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
parsed_uri = pjsip_uri_get_uri(parsed_name_addr->uri);
|
||||||
|
|
||||||
if (pj_strlen(&parsed_name_addr->display)) {
|
if (pj_strlen(&parsed_name_addr->display)) {
|
||||||
pj_strdup(tdata->pool, &name_addr->display, &parsed_name_addr->display);
|
pj_strdup(tdata->pool, &name_addr->display, &parsed_name_addr->display);
|
||||||
|
|||||||
Reference in New Issue
Block a user