[sr-dev] git:4.1:7e32dfcf: uac: Sanity checks

Stefan Mititelu stefan.mititelu at 1and1.ro
Tue Nov 3 15:37:30 CET 2015


Module: kamailio
Branch: 4.1
Commit: 7e32dfcf50e62577b406991972f6f99ae003c347
URL: https://github.com/kamailio/kamailio/commit/7e32dfcf50e62577b406991972f6f99ae003c347

Author: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Date: 2015-11-03T16:34:25+02:00

uac: Sanity checks

Sanity checks for decode_uri(). Add NULL and len > 0 checks.
Segfault when vsf parameter was empty in the Route: header (e.g 'vsf=').

---

Modified: modules/uac/replace.c

---

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

---

diff --git a/modules/uac/replace.c b/modules/uac/replace.c
index a996e54..f9d3ccf 100644
--- a/modules/uac/replace.c
+++ b/modules/uac/replace.c
@@ -142,6 +142,22 @@ static inline int decode_uri( str *src , str *dst)
 	int i,j;
 	signed char c;
 
+	/* sanity checks */
+	if (!src) {
+		LM_ERR("NULL src\n");
+		return -1;
+	}
+
+	if (!dst) {
+		LM_ERR("NULL dst\n");
+		return -1;
+	}
+
+	if (!src->s || src->len == 0) {
+		LM_ERR("empty src\n");
+		return -1;
+	}
+
 	/* Count '-' at end and disregard them */
 	for( n=0,i=src->len-1; src->s[i]=='-'; i--)
 		n++;




More information about the sr-dev mailing list