Skip to content
Snippets Groups Projects
Commit 0595c31d authored by Jørgen H's avatar Jørgen H Committed by Joshua Colp
Browse files

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
parent 9d3ab062
Branches
Tags
No related merge requests found
...@@ -1260,8 +1260,8 @@ int ast_sip_format_contact_ami(void *obj, void *arg, int flags) ...@@ -1260,8 +1260,8 @@ int ast_sip_format_contact_ami(void *obj, void *arg, int flags)
if (!ast_strlen_zero(contact->call_id)) { if (!ast_strlen_zero(contact->call_id)) {
ast_str_append(&buf, 0, "CallID: %s\r\n", 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)); ast_str_append(&buf, 0, "Status: %s\r\n", ast_sip_get_contact_status_label(status ? status->status : UNKNOWN));
if (status->status == UNKNOWN) { if (!status || status->status == UNKNOWN) {
ast_str_append(&buf, 0, "RoundtripUsec: N/A\r\n"); ast_str_append(&buf, 0, "RoundtripUsec: N/A\r\n");
} else { } else {
ast_str_append(&buf, 0, "RoundtripUsec: %" PRId64 "\r\n", status->rtt); ast_str_append(&buf, 0, "RoundtripUsec: %" PRId64 "\r\n", status->rtt);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment