From 2c4ed5922a2322f3b5059f6264884acfb5dec97f Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 5 Feb 2015 11:26:34 +0100 Subject: [PATCH] core: safety check for append_branch() when called with no uri and no msg - uri or msg parameter must be given, otherwise the new address cannot be set - get_redirects() from uac_redirect can execute this function with both parameters invalid in case of invalid contact, reported by Javi Gallart --- dset.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dset.c b/dset.c index 7ccdf53d78d..2fb3b7064ed 100644 --- a/dset.c +++ b/dset.c @@ -352,6 +352,11 @@ int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path, /* if not parameterized, take current uri */ if (uri==0 || uri->len==0 || uri->s==0) { + if(msg==NULL) { + LM_ERR("no new uri and no msg to take r-uri\n"); + ser_error = E_INVALID_PARAMS; + return -1; + } if (msg->new_uri.s) luri = msg->new_uri; else