From: George Joseph Date: Wed, 12 Jun 2019 18:03:04 +0000 (-0600) Subject: res_pjsip_messaging: Check for body in in-dialog message X-Git-Tag: certified/13.21-cert4~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=521581b762e9a72f1bcc6c4321db3fc53fdb084a;p=thirdparty%2Fasterisk.git 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 --- diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c index cbc6ea5612..362eb10f5c 100644 --- a/res/res_pjsip_messaging.c +++ b/res/res_pjsip_messaging.c @@ -90,9 +90,12 @@ static enum pjsip_status_code check_content_type_any_text(const pjsip_rx_data *r int res = PJSIP_SC_UNSUPPORTED_MEDIA_TYPE; pj_str_t text = { "text", 4}; + if (!(rdata->msg_info.msg->body && rdata->msg_info.msg->body->len > 0)) { + return res; + } + /* We'll accept any text/ content type */ - if (rdata->msg_info.msg->body && rdata->msg_info.msg->body->len - && pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0) { + if (pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0) { res = PJSIP_SC_OK; } else if (rdata->msg_info.ctype && pj_stricmp(&rdata->msg_info.ctype->media.type, &text) == 0) {