[sr-dev] git:4.2:7d88192a: siptrace: check if To header is parsed and available

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 29 12:45:30 CEST 2015


Module: kamailio
Branch: 4.2
Commit: 7d88192abe6e70b00fe6f2f429bb1486853e8dc6
URL: https://github.com/kamailio/kamailio/commit/7d88192abe6e70b00fe6f2f429bb1486853e8dc6

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-07-29T12:39:01+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

(cherry picked from commit 93b297e16134b0e74cf83e3604da01355a52e700)
(cherry picked from commit 8ba3be202f70a90ea88cdaac47fd2a7f9a9ef4f4)

---

Modified: modules/siptrace/siptrace.c

---

Diff:  https://github.com/kamailio/kamailio/commit/7d88192abe6e70b00fe6f2f429bb1486853e8dc6.diff
Patch: https://github.com/kamailio/kamailio/commit/7d88192abe6e70b00fe6f2f429bb1486853e8dc6.patch

---

diff --git a/modules/siptrace/siptrace.c b/modules/siptrace/siptrace.c
index 6914d48..b063b49 100644
--- a/modules/siptrace/siptrace.c
+++ b/modules/siptrace/siptrace.c
@@ -527,6 +527,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