[sr-dev] git:4.1:75e862db: 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:33:04 CET 2015


Module: kamailio
Branch: 4.1
Commit: 75e862dbca42de5ded8cb6cddbbeba823c46270c
URL: https://github.com/kamailio/kamailio/commit/75e862dbca42de5ded8cb6cddbbeba823c46270c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-02-05T11:32:47+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)
(cherry picked from commit a90e73327cccb5259af08cbf93f2a1b793a0ca2e)

---

Modified: dset.c

---

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

---

diff --git a/dset.c b/dset.c
index 4b886bd..ccb0abe 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