[sr-dev] git:master:1ea49ee2: sca: fix core when HDR_CSEQ not parsed

Victor Seva linuxmaniac at torreviejawireless.org
Wed Sep 21 09:03:03 CEST 2016


Module: kamailio
Branch: master
Commit: 1ea49ee2d4eced22dd76f7f4bc02467360b9ef16
URL: https://github.com/kamailio/kamailio/commit/1ea49ee2d4eced22dd76f7f4bc02467360b9ef16

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2016-09-20T17:52:03+02:00

sca: fix core when HDR_CSEQ not parsed

> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x00007f1820227bae in sca_call_info_update (msg=0x7f1828635930, p1=0x0, p2=0x0, p3=0x7f1828635930 "\001") at sca_call_info.c:1845
> 1845			LM_DBG("BUG: sca module does not support Call-Info headers "
> (gdb) p msg->cseq
> $1 = (struct hdr_field *) 0x0
> (gdb) p msg->first_line.u.request->method
> $2 = {
>  s = 0xa33540 <buf> "SUBSCRIBE sip:30 at 127.0.0.1:5060 SIP/2.0\r\nVia: SIP/2.0/UDP 172.17.0.2:5061;branch=z9hG4bK-2884-1-0\r\nFrom: sipp <sip:sipp at 172.17.0.2:5061>;tag=2884SIPpTag001\r\nTo: sut <sip:30 at 127.0.0.1:5060>\r\nCall-ID: 1"..., len = 9}

---

Modified: modules/sca/sca_call_info.c

---

Diff:  https://github.com/kamailio/kamailio/commit/1ea49ee2d4eced22dd76f7f4bc02467360b9ef16.diff
Patch: https://github.com/kamailio/kamailio/commit/1ea49ee2d4eced22dd76f7f4bc02467360b9ef16.patch

---

diff --git a/modules/sca/sca_call_info.c b/modules/sca/sca_call_info.c
index 8f8ca7e..d5586cb 100644
--- a/modules/sca/sca_call_info.c
+++ b/modules/sca/sca_call_info.c
@@ -1842,6 +1842,12 @@ int sca_call_info_update(sip_msg_t *msg, char *p1, char *p2, char *p3)
 		}
 	}
 	if (i >= n_dispatch) {
+		if(msg->cseq==NULL && ((parse_headers(msg, HDR_CSEQ_F, 0)==-1) ||
+			(msg->cseq==NULL)))
+		{
+			LM_ERR("no CSEQ header\n");
+			return (1);
+		}
 		LM_DBG("BUG: sca module does not support Call-Info headers "
 				"in %.*s requests\n", STR_FMT(&get_cseq(msg)->method));
 		return (1);




More information about the sr-dev mailing list