[sr-dev] git:master:f465d241: dispatcher: search in xavp sublist for ds_update_dst() attributes

Daniel-Constantin Mierla miconda at gmail.com
Fri Nov 16 16:38:22 CET 2018


Module: kamailio
Branch: master
Commit: f465d2410084ba9118c1f2610fbefa6989974ce9
URL: https://github.com/kamailio/kamailio/commit/f465d2410084ba9118c1f2610fbefa6989974ce9

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-11-16T16:37:06+01:00

dispatcher: search in xavp sublist for ds_update_dst() attributes

- safety checks for type of the value for root xavp
- related to GH #1725

---

Modified: src/modules/dispatcher/dispatch.c

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index b5677af058..80540ee6ba 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -2286,7 +2286,7 @@ int ds_update_dst(struct sip_msg *msg, int upos, int mode)
 	}
 
 	rxavp = xavp_get(&ds_xavp_dst, NULL);
-	if(rxavp == NULL) {
+	if(rxavp == NULL || rxavp->val.type != SR_XTYPE_XAVP) {
 		LM_DBG("no xavp with previous destination record\n");
 		return -1;
 	}
@@ -2297,12 +2297,14 @@ int ds_update_dst(struct sip_msg *msg, int upos, int mode)
 		xavp_rm(rxavp, NULL);
 
 		rxavp = xavp_get(&ds_xavp_dst, NULL);
-		if(rxavp == NULL) {
+		if(rxavp == NULL || rxavp->val.type != SR_XTYPE_XAVP) {
 			LM_DBG("no xavp with next destination record\n");
 			return -1;
 		}
 	}
 
+	/* retrieve attributes from sub list */
+	rxavp = rxavp->val.v.xavp;
 	lxavp = xavp_get(&ds_xavp_dst_sock, rxavp);
 	if(lxavp!=NULL && lxavp->val.type==SR_XTYPE_VPTR) {
 		LM_DBG("socket enforced in next destination record\n");




More information about the sr-dev mailing list