1 From 785bf3a755e47d92caef110e6040295764d08127 Mon Sep 17 00:00:00 2001
2 From: George Joseph <gjoseph@digium.com>
3 Date: Wed, 12 Jun 2019 12:03:04 -0600
4 Subject: [PATCH] res_pjsip_messaging: Check for body in in-dialog message
6 We now check that a body exists and it has a length > 0 before
7 attempting to process it.
10 Reported-by: Gil Richard
12 Change-Id: Ic469544b22ab848734636588d4c93426cc6f4b1f
14 res/res_pjsip_messaging.c | 9 ++++++---
15 1 file changed, 6 insertions(+), 3 deletions(-)
17 diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c
18 index 0e10a8f047..930cf84a53 100644
19 --- a/res/res_pjsip_messaging.c
20 +++ b/res/res_pjsip_messaging.c
21 @@ -90,10 +90,13 @@ static enum pjsip_status_code check_content_type_in_dialog(const pjsip_rx_data *
22 static const pj_str_t text = { "text", 4};
23 static const pj_str_t application = { "application", 11};
25 + if (!(rdata->msg_info.msg->body && rdata->msg_info.msg->body->len > 0)) {
29 /* We'll accept any text/ or application/ content type */
30 - if (rdata->msg_info.msg->body && rdata->msg_info.msg->body->len
31 - && (pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0
32 - || pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &application) == 0)) {
33 + if (pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0
34 + || pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &application) == 0) {
36 } else if (rdata->msg_info.ctype
37 && (pj_stricmp(&rdata->msg_info.ctype->media.type, &text) == 0