summaryrefslogtreecommitdiff
path: root/res/res_pjsip_messaging.c
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2013-11-12 16:49:17 +0000
committerKevin Harwell <kharwell@digium.com>2013-11-12 16:49:17 +0000
commit12a0edac6956e79503def0c8949823d8586c440a (patch)
tree2043f6bf7703ae161ae7f56bc7b4729990adbbd0 /res/res_pjsip_messaging.c
parent4f61528fbabbaf08886489ae6d93efb5c75e4dfb (diff)
pjsip_messaging, pjsip_header_funcs: Crashes due to NULL pointer dereferences
Both res_pjsip_messaging and res_pjsip_header_funcs were causing asterisk to crash because they were trying to dereference a NULL pointer. In the case of res_pjsip_messaging it was attempting to "print" a contact header that did not exist. In fact contact headers should not be part of a SIP MESSAGE, so the offending code was simply removed. In the case of res_pjsip_header_funcs a null private channel tech was being passed to the function and then later dereferenced. Added null checks (and error logging) to the read/write function handlers to guard against crashing. (closes issue ASTERISK-22821) Reported by: Anthony Messina ........ Merged revisions 402757 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402758 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_messaging.c')
-rw-r--r--res/res_pjsip_messaging.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c
index c2dea7f19..b66ee0b11 100644
--- a/res/res_pjsip_messaging.c
+++ b/res/res_pjsip_messaging.c
@@ -431,15 +431,9 @@ static enum pjsip_status_code rx_data_to_ast_msg(pjsip_rx_data *rdata, struct as
CHECK_RES(ast_msg_set_from(msg, "%s", buf));
}
- /* contact header */
- if ((size = pjsip_hdr_print_on(pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL), buf, sizeof(buf)-1)) > 0) {
- buf[size] = '\0';
- CHECK_RES(ast_msg_set_var(msg, "SIP_FULLCONTACT", buf));
- }
-
/* receive address */
field = pj_sockaddr_print(&rdata->pkt_info.src_addr, buf, sizeof(buf)-1, 1);
- CHECK_RES(ast_msg_set_var(msg, "SIP_RECVADDR", field));
+ CHECK_RES(ast_msg_set_var(msg, "PJSIP_RECVADDR", field));
/* body */
if (print_body(rdata, buf, sizeof(buf) - 1) > 0) {
@@ -448,7 +442,7 @@ static enum pjsip_status_code rx_data_to_ast_msg(pjsip_rx_data *rdata, struct as
/* endpoint name */
if (endpt->id.self.name.valid) {
- CHECK_RES(ast_msg_set_var(msg, "SIP_PEERNAME", endpt->id.self.name.str));
+ CHECK_RES(ast_msg_set_var(msg, "PJSIP_PEERNAME", endpt->id.self.name.str));
}
CHECK_RES(headers_to_vars(rdata, msg));