[sr-dev] git:4.2:a90e7332: core: safety check for append_branch() when called with no uri and no msg

Daniel-Constantin Mierla miconda at gmail.com
Thu Feb 5 11:30:40 CET 2015


Module: kamailio
Branch: 4.2
Commit: a90e73327cccb5259af08cbf93f2a1b793a0ca2e
URL: https://github.com/kamailio/kamailio/commit/a90e73327cccb5259af08cbf93f2a1b793a0ca2e

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-02-05T11:30:23+01:00

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

(cherry picked from commit 2c4ed5922a2322f3b5059f6264884acfb5dec97f)

---

Modified: dset.c

---

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

---

diff --git a/dset.c b/dset.c
index 8e7410e..9c28445 100644
--- a/dset.c
+++ b/dset.c
@@ -341,6 +341,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




More information about the sr-dev mailing list