[Asterisk-code-review] res_pjsip_aoc: Don't assume a body exists on responses. (asterisk[master])

Friendly Automation asteriskteam at digium.com
Tue Dec 13 10:52:14 CST 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19724 )

Change subject: res_pjsip_aoc: Don't assume a body exists on responses.
......................................................................

res_pjsip_aoc: Don't assume a body exists on responses.

When adding AOC to an outgoing response the code
assumed that a body would exist for comparing the
Content-Type. This isn't always true.

The code now checks to make sure the response has
a body before checking the Content-Type.

ASTERISK-21502

Change-Id: Iaead371434fc3bc693dad487228106a7d7a5ac76
---
M res/res_pjsip_aoc.c
1 file changed, 19 insertions(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit




diff --git a/res/res_pjsip_aoc.c b/res/res_pjsip_aoc.c
index dba4e26..6e3d81d 100644
--- a/res/res_pjsip_aoc.c
+++ b/res/res_pjsip_aoc.c
@@ -628,7 +628,7 @@
 		return;
 	}
 
-	if (pjsip_media_type_cmp(&tdata->msg->body->content_type,
+	if (tdata->msg->body && pjsip_media_type_cmp(&tdata->msg->body->content_type,
 			&pjsip_media_type_multipart_mixed, 0) == 0) {
 		multipart_body = tdata->msg->body;
 	} else {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19724
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Iaead371434fc3bc693dad487228106a7d7a5ac76
Gerrit-Change-Number: 19724
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221213/c9a50c65/attachment.html>


More information about the asterisk-code-review mailing list