diff --git a/modules/uac/replace.c b/modules/uac/replace.c index a996e547eb2..f9d3ccfe239 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++;