diff options
author | Kevin Harwell <kharwell@digium.com> | 2018-01-03 10:41:46 -0600 |
---|---|---|
committer | Kevin Harwell <kharwell@digium.com> | 2018-01-03 10:46:25 -0600 |
commit | 62f862e2cdcdb7fc8e31bc4bd3dbb1ae43b8ce1d (patch) | |
tree | 6eafffb262720d9bc07d2deea7a03de24567e227 /res | |
parent | 84d0871380cb6f696ef22f9c54f55034d0939005 (diff) |
res_pjsip_session: Check if sequence header is missing
The pjsip_msg_find_hdr function can return NULL. This patch adds a check
when searching for the sequence header to make sure a NULL pointer is never
de-referenced.
Change-Id: I19af23aeeded65be016be92360e8cb7ffe51fad2
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip_session.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 64c150e3c..c3393823e 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -3309,6 +3309,12 @@ static void handle_outgoing_response(struct ast_sip_session *session, pjsip_tx_d struct ast_sip_session_supplement *supplement; struct pjsip_status_line status = tdata->msg->line.status; pjsip_cseq_hdr *cseq = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL); + + if (!cseq) { + ast_log(LOG_ERROR, "Cannot send response due to missing sequence header"); + return; + } + ast_debug(3, "Method is %.*s, Response is %d %.*s\n", (int) pj_strlen(&cseq->method.name), pj_strbuf(&cseq->method.name), status.code, (int) pj_strlen(&status.reason), pj_strbuf(&status.reason)); |