[sr-dev] git:master:93b297e1: siptrace: check if To header is parsed and available

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 24 12:44:37 CEST 2015


Module: kamailio
Branch: master
Commit: 93b297e16134b0e74cf83e3604da01355a52e700
URL: https://github.com/kamailio/kamailio/commit/93b297e16134b0e74cf83e3604da01355a52e700

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-07-24T12:43:26+02:00

siptrace: check if To header is parsed and available

- it is accessed and can lead to crash if not prepared
- reported by GH #263

---

Modified: modules/siptrace/siptrace.c

---

Diff:  https://github.com/kamailio/kamailio/commit/93b297e16134b0e74cf83e3604da01355a52e700.diff
Patch: https://github.com/kamailio/kamailio/commit/93b297e16134b0e74cf83e3604da01355a52e700.patch

---

diff --git a/modules/siptrace/siptrace.c b/modules/siptrace/siptrace.c
index 4ee8f00..df6ceff 100644
--- a/modules/siptrace/siptrace.c
+++ b/modules/siptrace/siptrace.c
@@ -535,6 +535,11 @@ static int sip_trace_prepare(sip_msg_t *msg)
 		goto error;
 	}
 
+	if(parse_to_header(msg)==-1 || msg->to==NULL || get_to(msg)==NULL) {
+		LM_ERR("cannot parse To header\n");
+		goto error;
+	}
+
 	if(parse_headers(msg, HDR_CALLID_F, 0)!=0 || msg->callid==NULL
 			|| msg->callid->body.s==NULL) {
 		LM_ERR("cannot parse call-id\n");




More information about the sr-dev mailing list