Ver Fonte

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 há 10 anos atrás
pai
commit
2c4ed5922a
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      dset.c

+ 5 - 0
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