[sr-dev] git:master:24c92c4f: htable: safety checks for values replicated via dmq

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 20 12:34:36 CET 2018


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-11-20T12:34:15+01:00

htable: safety checks for values replicated via dmq

---

Modified: src/modules/htable/ht_dmq.c

---

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

---

diff --git a/src/modules/htable/ht_dmq.c b/src/modules/htable/ht_dmq.c
index d5ff1af645..986c2c769a 100644
--- a/src/modules/htable/ht_dmq.c
+++ b/src/modules/htable/ht_dmq.c
@@ -575,15 +575,18 @@ int ht_dmq_handle_sync(srjson_doc_t* jdoc) {
 			}
 		}
 
-		ht = ht_get_table(&htname);
-		if(ht==NULL) {
-			LM_WARN("unable to get table %.*s\n",
-					htname.len, (htname.s)?htname.s:"");
-		}
+		if(htname.s!=NULL && htname.len>0 && cname.s!=NULL
+				&& cname.len>0) {
+			ht = ht_get_table(&htname);
+			if(ht==NULL) {
+				LM_WARN("unable to get table %.*s\n",
+						htname.len, (htname.s)?htname.s:"");
+			}
 
-		if (ht_set_cell_ex(ht, &cname, type, &val, 0, expire - now) < 0) {
-			LM_WARN("unable to set cell %.*s in table %.*s\n",
-					cname.len, cname.s, ht->name.len, ht->name.s);
+			if (ht_set_cell_ex(ht, &cname, type, &val, 0, expire - now) < 0) {
+				LM_WARN("unable to set cell %.*s in table %.*s\n",
+						cname.len, cname.s, ht->name.len, ht->name.s);
+			}
 		}
 
 		cell = cell->next;




More information about the sr-dev mailing list