[sr-dev] git:master:e415c3a0: dialog: safety check of return pointer to dmq vars field

Daniel-Constantin Mierla miconda at gmail.com
Thu Nov 3 11:18:31 CET 2016


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-11-03T11:17:38+01:00

dialog: safety check of return pointer to dmq vars field

---

Modified: modules/dialog/dlg_dmq.c

---

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

---

diff --git a/modules/dialog/dlg_dmq.c b/modules/dialog/dlg_dmq.c
index 0d47056..668bdbd 100644
--- a/modules/dialog/dlg_dmq.c
+++ b/modules/dialog/dlg_dmq.c
@@ -112,6 +112,7 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp, dmq_node_t* no
 		from_uri = {0,0}, to_uri = {0,0}, req_uri = {0,0};
 	unsigned int init_ts = 0, start_ts = 0, lifetime = 0;
 	unsigned int state = 1;
+	srjson_t *vj;
 
 	/* received dmq message */
 	LM_DBG("dmq message received\n");
@@ -256,13 +257,14 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp, dmq_node_t* no
 			dlg->init_ts = init_ts;
 			dlg->start_ts = start_ts;
 
-			srjson_t *vj;
 			vj = srjson_GetObjectItem(&jdoc, jdoc.root, "vars");
-			for(it=vj->child; it; it = it->next)
-			{
-				k.s = it->string;        k.len = strlen(k.s);
-				v.s = it->valuestring;   v.len = strlen(v.s);
-				set_dlg_variable(dlg, &k, &v);
+			if(vj!=NULL) {
+				for(it=vj->child; it; it = it->next)
+				{
+					k.s = it->string;        k.len = strlen(k.s);
+					v.s = it->valuestring;   v.len = strlen(v.s);
+					set_dlg_variable(dlg, &k, &v);
+				}
 			}
 			/* add profiles */
 			if(profiles.s!=NULL) {




More information about the sr-dev mailing list