[sr-dev] git:4.4:4180f5bf: topoh: safety check to avoid crash when there is no via header

Daniel-Constantin Mierla miconda at gmail.com
Fri Jan 27 09:08:31 CET 2017


Module: kamailio
Branch: 4.4
Commit: 4180f5bf64b6b4338f99ba0eb7d2146ef86c088e
URL: https://github.com/kamailio/kamailio/commit/4180f5bf64b6b4338f99ba0eb7d2146ef86c088e

Author: Minh Phan <pqminh at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-01-27T09:07:52+01:00

topoh: safety check to avoid crash when there is no via header

- based on GH #952

(cherry picked from commit 2367fb52aa94bd06fcbadce7f9ecccdcf6e36c83)

---

Modified: modules/topoh/th_msg.c

---

Diff:  https://github.com/kamailio/kamailio/commit/4180f5bf64b6b4338f99ba0eb7d2146ef86c088e.diff
Patch: https://github.com/kamailio/kamailio/commit/4180f5bf64b6b4338f99ba0eb7d2146ef86c088e.patch

---

diff --git a/modules/topoh/th_msg.c b/modules/topoh/th_msg.c
index 40a956e..a070c27 100644
--- a/modules/topoh/th_msg.c
+++ b/modules/topoh/th_msg.c
@@ -954,6 +954,10 @@ int th_add_hdr_cookie(sip_msg_t *msg)
 struct via_param *th_get_via_cookie(sip_msg_t *msg, struct via_body *via)
 {
 	struct via_param *p;
+
+	if (!via) {
+		return NULL;
+	}
 	for(p=via->param_lst; p; p=p->next)
 	{
 		if(p->name.len==th_cookie_name.len




More information about the sr-dev mailing list