Browse code

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

Daniel-Constantin Mierla authored on 05/02/2015 10:26:34
Showing 1 changed files
... ...
@@ -352,6 +352,11 @@ int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
352 352
 
353 353
 	/* if not parameterized, take current uri */
354 354
 	if (uri==0 || uri->len==0 || uri->s==0) {
355
+		if(msg==NULL) {
356
+			LM_ERR("no new uri and no msg to take r-uri\n");
357
+			ser_error = E_INVALID_PARAMS;
358
+			return -1;
359
+		}
355 360
 		if (msg->new_uri.s)
356 361
 			luri = msg->new_uri;
357 362
 		else