[sr-dev] git:master:c47ec08d: presence: safety checks for user and domain in ps_ptable_search()

Daniel-Constantin Mierla miconda at gmail.com
Tue Feb 8 10:25:50 CET 2022


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-02-08T10:23:22+01:00

presence: safety checks for user and domain in ps_ptable_search()

- GH #3008

---

Modified: src/modules/presence/hash.c

---

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

---

diff --git a/src/modules/presence/hash.c b/src/modules/presence/hash.c
index c313b01cf0..5d0f0a9568 100644
--- a/src/modules/presence/hash.c
+++ b/src/modules/presence/hash.c
@@ -1247,6 +1247,11 @@ ps_presentity_t *ps_ptable_search(ps_presentity_t *ptm, int mmode, int rmode)
 	uint32_t idx = 0;
 	int pmax = 0;
 
+	if(ptm->user.s==NULL || ptm->domain.s==NULL) {
+		LM_WARN("no user or domain for presentity\n");
+		return NULL;
+	}
+
 	ptm->hashid = core_case_hash(&ptm->user, &ptm->domain, 0);
 	idx = core_hash_idx(ptm->hashid, _ps_ptable->ssize);
 




More information about the sr-dev mailing list