diff options
author | Jørgen H <asterisk.org@hovland.cx> | 2017-02-16 10:16:47 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2017-02-27 15:16:57 -0600 |
commit | ee0a123f436042ac685b8046949e45726ae161c9 (patch) | |
tree | ba585fe561c6e0ec9dd10130ab6c0c2464653a8b /res/res_pjsip/pjsip_options.c | |
parent | ca7fa7bbd2d54766f6b5911d7aa046cdcfd0dfe8 (diff) |
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
Diffstat (limited to 'res/res_pjsip/pjsip_options.c')
-rw-r--r-- | res/res_pjsip/pjsip_options.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c index 6fd3c2575..662166c89 100644 --- a/res/res_pjsip/pjsip_options.c +++ b/res/res_pjsip/pjsip_options.c @@ -1250,8 +1250,8 @@ int ast_sip_format_contact_ami(void *obj, void *arg, int flags) 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); |