mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
res_pjsip: Validate that contact uris start with sip: or sips:
Currently we use pjsip_parse_hdr to validate contact uris but it appears that it allows uris without a scheme if there's a port supplied. I.E myexample.com will fail but myexample.com:5060 will pass even though it has no scheme. This causes SEGVs later on whenever the uri is used. To prevent this, permanent_contact_validate has been updated to check that the scheme is either 'sip' or 'sips'. 2 uses of possibly-null endpoint have also been fixed in create_out_of_dialog_request. ASTERISK-24999 Change-Id: Ifc17d16a4923e1045d37fe51e43bbe29fa556ca2 Reported-by: Brad Latus
This commit is contained in:
@@ -2717,7 +2717,8 @@ static int create_out_of_dialog_request(const pjsip_method *method, struct ast_s
|
||||
if (sip_dialog_create_from(pool, &from, endpoint ? endpoint->fromuser : NULL,
|
||||
endpoint ? endpoint->fromdomain : NULL, &remote_uri, &selector)) {
|
||||
ast_log(LOG_ERROR, "Unable to create From header for %.*s request to endpoint %s\n",
|
||||
(int) pj_strlen(&method->name), pj_strbuf(&method->name), ast_sorcery_object_get_id(endpoint));
|
||||
(int) pj_strlen(&method->name), pj_strbuf(&method->name),
|
||||
endpoint ? ast_sorcery_object_get_id(endpoint) : "<none>");
|
||||
pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
|
||||
return -1;
|
||||
}
|
||||
@@ -2725,7 +2726,8 @@ static int create_out_of_dialog_request(const pjsip_method *method, struct ast_s
|
||||
if (pjsip_endpt_create_request(ast_sip_get_pjsip_endpoint(), method, &remote_uri,
|
||||
&from, &remote_uri, &from, NULL, -1, NULL, tdata) != PJ_SUCCESS) {
|
||||
ast_log(LOG_ERROR, "Unable to create outbound %.*s request to endpoint %s\n",
|
||||
(int) pj_strlen(&method->name), pj_strbuf(&method->name), ast_sorcery_object_get_id(endpoint));
|
||||
(int) pj_strlen(&method->name), pj_strbuf(&method->name),
|
||||
endpoint ? ast_sorcery_object_get_id(endpoint) : "<none>");
|
||||
pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user