<p>Benjamin Keith Ford would like George Joseph to <strong>review</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11558">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_messaging: Check for body in in-dialog message<br><br>We now check that a body exists and it has a length > 0 before<br>attempting to process it.<br><br>ASTERISK-28447<br>Reported-by: Gil Richard<br><br>Change-Id: Ic469544b22ab848734636588d4c93426cc6f4b1f<br>---<br>M res/res_pjsip_messaging.c<br>1 file changed, 11 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/58/11558/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c</span><br><span>index cbc6ea5..b9d4a87 100644</span><br><span>--- a/res/res_pjsip_messaging.c</span><br><span>+++ b/res/res_pjsip_messaging.c</span><br><span>@@ -88,14 +88,20 @@</span><br><span> static enum pjsip_status_code check_content_type_any_text(const pjsip_rx_data *rdata)</span><br><span> {</span><br><span> int res = PJSIP_SC_UNSUPPORTED_MEDIA_TYPE;</span><br><span style="color: hsl(0, 100%, 40%);">- pj_str_t text = { "text", 4};</span><br><span style="color: hsl(120, 100%, 40%);">+ static const pj_str_t text = { "text", 4};</span><br><span style="color: hsl(120, 100%, 40%);">+ static const pj_str_t application = {"application", 11};</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /* We'll accept any text/ content type */</span><br><span style="color: hsl(0, 100%, 40%);">- if (rdata->msg_info.msg->body && rdata->msg_info.msg->body->len</span><br><span style="color: hsl(0, 100%, 40%);">- && pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!(rdata->msg_info.msg->body && rdata->msg_info.msg->body->len > 0)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* We'll accept any text/ or application/ content type */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0</span><br><span style="color: hsl(120, 100%, 40%);">+ || pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &application) == 0) {</span><br><span> res = PJSIP_SC_OK;</span><br><span> } else if (rdata->msg_info.ctype</span><br><span style="color: hsl(0, 100%, 40%);">- && pj_stricmp(&rdata->msg_info.ctype->media.type, &text) == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ && (pj_stricmp(&rdata->msg_info.ctype->media.type, &text) == 0</span><br><span style="color: hsl(120, 100%, 40%);">+ || pj_stricmp(&rdata->msg_info.ctype->media.type, &application) == 0)) {</span><br><span> res = PJSIP_SC_OK;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11558">change 11558</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/11558"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: certified/13.21 </div>
<div style="display:none"> Gerrit-Change-Id: Ic469544b22ab848734636588d4c93426cc6f4b1f </div>
<div style="display:none"> Gerrit-Change-Number: 11558 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>