Module: kamailio
Branch: master
Commit: e415c3a0493b15c19b8a7984ddaff0bfd170a5ed
URL:
https://github.com/kamailio/kamailio/commit/e415c3a0493b15c19b8a7984ddaff0b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)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/e415c3a0493b15c19b8a7984ddaff0b…
Patch:
https://github.com/kamailio/kamailio/commit/e415c3a0493b15c19b8a7984ddaff0b…
---
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) {