[Asterisk-code-review] res pjsip: Fix crash when contact has no status (asterisk[master])

Joshua Colp asteriskteam at digium.com
Tue Feb 28 10:24:45 CST 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/4967 )

Change subject: res_pjsip: Fix crash when contact has no status
......................................................................


res_pjsip: Fix crash when contact has no status

This change fixes an assumption in res_pjsip that a contact will
always have a status. There is a race condition where this is
not true and would crash. The status will now be unknown when
this situation occurs.

ASTERISK-26623 #close

Change-Id: Id52d3ca4d788562d236da49990a319118f8d22b5
---
M res/res_pjsip/pjsip_options.c
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve; Verified



diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c
index 6fd3c25..662166c 100644
--- a/res/res_pjsip/pjsip_options.c
+++ b/res/res_pjsip/pjsip_options.c
@@ -1250,8 +1250,8 @@
 	if (!ast_strlen_zero(contact->call_id)) {
 		ast_str_append(&buf, 0, "CallID: %s\r\n", contact->call_id);
 	}
-	ast_str_append(&buf, 0, "Status: %s\r\n", ast_sip_get_contact_status_label(status->status));
-	if (status->status == UNKNOWN) {
+	ast_str_append(&buf, 0, "Status: %s\r\n", ast_sip_get_contact_status_label(status ? status->status : UNKNOWN));
+	if (!status || status->status == UNKNOWN) {
 		ast_str_append(&buf, 0, "RoundtripUsec: N/A\r\n");
 	} else {
 		ast_str_append(&buf, 0, "RoundtripUsec: %" PRId64 "\r\n", status->rtt);

-- 
To view, visit https://gerrit.asterisk.org/4967
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id52d3ca4d788562d236da49990a319118f8d22b5
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Jørgen H <asterisk.org at hovland.cx>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list