[sr-dev] git:4.1: Improved Free at cscf_get_service_route(), caused a reproducable crash

Hugh Waite hugh.waite at crocodile-rcs.com
Wed Jan 8 15:02:44 CET 2014


Module: sip-router
Branch: 4.1
Commit: bf0a544d135b029ad381746b380bb6f71c52aee7
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bf0a544d135b029ad381746b380bb6f71c52aee7

Author: Carsten Bock <carsten at ng-voice.com>
Committer: Hugh Waite <hugh.waite at crocodile-rcs.com>
Date:   Mon Dec  9 23:00:08 2013 +0100

Improved Free at cscf_get_service_route(), caused a reproducable crash
(cherry picked from commit caa9954d3c017ce741245d8f2b338158caf2270f)

---

 lib/ims/ims_getters.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/ims/ims_getters.c b/lib/ims/ims_getters.c
index 05450f1..8fce196 100644
--- a/lib/ims/ims_getters.c
+++ b/lib/ims/ims_getters.c
@@ -1361,14 +1361,16 @@ str* cscf_get_service_route(struct sip_msg *msg, int *size, int is_shm) {
 		h = h->next;
 	}
 	if (is_shm) {
-		while (h)
+		h = msg->headers;
+		while (h) {
 			if (h->name.len == 13
 					&& strncasecmp(h->name.s, "Service-Route", 13) == 0) {
 				h->parsed = 0;
 				r = (rr_t*) h->parsed;
 				free_rr(&r);
 			}
-		h = h->next;
+			h = h->next;
+		}
 	}
 
 	return x;




More information about the sr-dev mailing list