mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 14:58:25 +00:00
res_pjsip_messaging: Check for body in in-dialog message
We now check that a body exists and it has a length > 0 before attempting to process it. ASTERISK-28447 Reported-by: Gil Richard Change-Id: Ic469544b22ab848734636588d4c93426cc6f4b1f
This commit is contained in:
committed by
Benjamin Keith Ford
parent
152d446bef
commit
86c8830b91
@@ -91,10 +91,13 @@ static enum pjsip_status_code check_content_type_in_dialog(const pjsip_rx_data *
|
|||||||
static const pj_str_t text = { "text", 4};
|
static const pj_str_t text = { "text", 4};
|
||||||
static const pj_str_t application = { "application", 11};
|
static const pj_str_t application = { "application", 11};
|
||||||
|
|
||||||
|
if (!(rdata->msg_info.msg->body && rdata->msg_info.msg->body->len > 0)) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/* We'll accept any text/ or application/ content type */
|
/* We'll accept any text/ or application/ content type */
|
||||||
if (rdata->msg_info.msg->body && rdata->msg_info.msg->body->len
|
if (pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0
|
||||||
&& (pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0
|
|| pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &application) == 0) {
|
||||||
|| pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &application) == 0)) {
|
|
||||||
res = PJSIP_SC_OK;
|
res = PJSIP_SC_OK;
|
||||||
} else if (rdata->msg_info.ctype
|
} else if (rdata->msg_info.ctype
|
||||||
&& (pj_stricmp(&rdata->msg_info.ctype->media.type, &text) == 0
|
&& (pj_stricmp(&rdata->msg_info.ctype->media.type, &text) == 0
|
||||||
|
|||||||
Reference in New Issue
Block a user